【问题标题】:Ext JS Grid Panel Checkbox is deselectedExt JS 网格面板复选框被取消选中
【发布时间】:2015-01-03 21:55:34
【问题描述】:

我正在使用带有复选框选择模型的 GridPanel。我有一列呈现为文本字段供用户输入数量。问题是,一旦我为一个项目输入了一个值,即使我为'checkOnly'设置了true,上一行的复选框也会被取消选择

下面是我的网格面板

Ext.define('demo.view.productsGridPanel', {
extend : 'Ext.grid.Panel',
alias : 'widget.productsGridPanel',


selModel: Ext.create('Ext.selection.CheckboxModel', {
                        mode: 'MULTI', 
                        checkOnly: true
            }),

plugins: [
    Ext.create('Ext.grid.plugin.CellEditing', {
        clicksToEdit: 1
    })
],



initComponent : function() {

    var me = this;

    this.store = Ext.StoreManager.get('demo.store.Products');

    this.columns = [ 
        {
            header : 'Product Code',
            dataIndex : 'code',
            flex : 1
        }, 
        {
            header : 'Product Name',
            dataIndex : 'name',
            flex : 2
        }, 
        {
            header : 'Product Price',
            dataIndex : 'price',
            flex : 1
        },
        {
             header: 'Enter Qty',               
             flex: 1,
             dataIndex : 'quantity',
             editor: {
                    xtype: 'textfield',
                    allowBlank: true
             }
        },

    ];



    this.callParent(arguments);
}

});

任何帮助将不胜感激。

【问题讨论】:

    标签: extjs extjs4.2


    【解决方案1】:

    我已将您的代码转换为 Sencha Fiddle,并且无法复制您遇到的问题。您得到的错误一定是由其他原因引起的。运行此程序时,您是否在浏览器控制台中看到错误?

    更新:我注意到输入可编辑文本字段时出现错误。在输入该字段时,该行的复选框被取消选中。

    这是 ExtJs 4.0.7 版中的一个已知错误,据说在以后的版本中已修复,尽管它似乎在任何版本中都没有修复。可以在 GitHub 上的 HERE 上找到一个临时错误修复,上面的小提琴中有一个正在使用的演示,但它似乎只适用于 ExtJs 版本 4.0.7。

    我会将此作为错误发布在 Sencha 论坛上,以便重新调查该问题。

    我会进一步调查这个问题,如果我想出更好的解决方案,请告诉你。我刚刚在 ExtJS 5 中对此进行了测试,它可以正常工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多