In Extjs4 how to set cellediting's disable /enable functionality

4k Views Asked by At

i am working in extjs. I have libraryview with grid cellediting plugin as-

Ext.define('H.view.library.LibraryListView', {
    extend: 'Ext.grid.Panel',
    alias : 'widget.librarylistview',
    id:'librarylistviewId',
    store: 'LibraryFileStore',
    requires:['RUI.view.campaign.ImageViewer'],
    plugins:[
        Ext.create('Ext.grid.plugin.CellEditing',{
            clicksToEdit: 1,
            listeners: {
                   'edit': function(editor,e) {
                    var me=this; 
                    title = e.value;
                    id = e.record.get('id');
                    }
              }
        })
    ],

I want to disable this editing when status=0. So what changes i need to do for disabling and enabling cellediting depending upon condition

1

There are 1 best solutions below

0
4zh4r_s4l4ti On

You can disable the editing by adding beforeEdit event on the grid -

yourGrid.on('beforeedit',function(editor,e){    
    if(your condition){
        return false;//this will disable the cell editing
    }    
});

You can get more information about the beforeedit event and the different values that you can get from the parameters of this function over here -

http://docs.sencha.com/extjs/4.1.0/#!/api/Ext.grid.Panel-event-beforeedit