【问题标题】:In Extjs4 how to set cellediting's disable /enable functionality在 Extjs4 中如何设置 cellediting 的禁用/启用功能
【发布时间】:2013-09-11 09:23:09
【问题描述】:

我在 extjs 工作。我有带有网格单元编辑插件的 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');
                    }
              }
        })
    ],

我想在 status=0 时禁用此编辑。那么我需要根据条件进行哪些更改来禁用和启用单元格编辑

【问题讨论】:

    标签: grid extjs4 celleditorlistener


    【解决方案1】:

    您可以通过在网格上添加 beforeEdit 事件来禁用编辑 -

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

    您可以在此处获得有关 beforeedit 事件的更多信息以及您可以从该函数的参数中获得的不同值 -

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-06-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-16
      相关资源
      最近更新 更多