简体   繁体   English

在Extjs4中如何设置cellediting的禁用/启用功能

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

i am working in extjs. 我在extjs中工作。 I have libraryview with grid cellediting plugin as- 我有带网格单元格编辑插件的libraryview-

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. 我想在状态= 0时禁用此编辑。 So what changes i need to do for disabling and enabling cellediting depending upon condition 那么我需要根据条件禁用和启用单元格编辑进行哪些更改

You can disable the editing by adding beforeEdit event on the grid - 您可以通过在网格上添加beforeEdit事件来禁用编辑-

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 - 您可以在此处获取有关beforeedit事件以及可以从此函数的参数获取的不同值的更多信息-

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM