<commit_before>/**
 * Abstract ViewController for CRUD views.
 */
Ext.define('StarterKit.view.CrudController', {
    extend: 'Ext.app.ViewController',
    
    requires: [
        'Ext.window.MessageBox'
    ],
    
    listen: {
        controller: {
            '*': {
                login_success: 'onLogin'
            }
        }
    },
    
    onLogin: function() {
        this.lookupReference('grid').getStore().load();
    },
    
    onClickButton: function () {
        Ext.Msg.confirm('Confirm', 'Are you sure?', 'onConfirm', this);
    },
    
    onConfirm: Ext.emptyFn,
    
    onAdd: function() {
        var grid, store, Model, plugin, record;
        
        grid = this.lookupReference('grid');
        store = grid.getStore();
        Model = store.getModel();
        plugin = grid.getPlugin('editor');
        
        record = new Model();
        store.add(record);
        plugin.startEdit(record);
    },
    
    onDelete: function() {
        var grid, store, selection, i, len;
        
        grid = this.lookupReference('grid');
        store = grid.getStore();
        selection = grid.getSelectionModel().getSelection();
        
        for (i = 0, len = selection.length; i < len; i++) {
            store.remove(selection[i]);
        }
    },

    onSync: function() {
        var grid, store;

        grid = this.lookupReference('grid');
        store = grid.getStore();
        store.sync();
    }

});<commit_msg>added function for edit button<commit_after>/**
 * Abstract ViewController for CRUD views.
 */
Ext.define('StarterKit.view.CrudController', {
    extend: 'Ext.app.ViewController',
    
    requires: [
        'Ext.window.MessageBox'
    ],
    
    listen: {
        controller: {
            '*': {
                login_success: 'onLogin'
            }
        }
    },
    
    onLogin: function() {
        this.lookupReference('grid').getStore().load();
    },
    
    onClickButton: function () {
        Ext.Msg.confirm('Confirm', 'Are you sure?', 'onConfirm', this);
    },
    
    onConfirm: Ext.emptyFn,
    
    onAdd: function() {
        var grid, store, Model, plugin, record;
        
        grid = this.lookupReference('grid');
        store = grid.getStore();
        Model = store.getModel();
        plugin = grid.getPlugin('editor');
        
        record = new Model();
        store.add(record);
        plugin.startEdit(record);
    },

    onEdit: function () {
        var grid, record;

        grid = this.lookupReference('grid');
        selection = grid.getSelectionModel().getSelection();
        record = selection[0];
        grid.getPlugin('editor').startEdit(record);
    },
    
    onDelete: function() {
        var grid, store, selection, i, len;
        
        grid = this.lookupReference('grid');
        store = grid.getStore();
        selection = grid.getSelectionModel().getSelection();
        
        for (i = 0, len = selection.length; i < len; i++) {
            store.remove(selection[i]);
        }
    },

    onSync: function() {
        var grid, store;

        grid = this.lookupReference('grid');
        store = grid.getStore();
        store.sync();
    }

});
{'fraction_non_alphanumeric': 0.14505494505494507, 'fraction_numerical': 0.0009419152276295133, 'mean_word_length': 1.814487632508834, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '798928', 'n_tokens_mistral': 915, 'n_tokens_neox': 904, 'n_words': 180}