首页 > 代码库 > extjs form isvalid的bug

extjs form isvalid的bug


版本:ext4.2.1

问题:

在Form中嵌套girdEditor,只要编辑过grid,那么Form的isDirty()永远是ture。


Form代码:

Ext.define("Soims.view.application.SampleInfoForm", {
    extend: ‘Ext.form.Panel‘,
    alias: ‘widget.sampleinfoform‘,
    title: ‘样品信息‘,
    initComponent: function () {
        this.items = [{
            xtype: ‘fieldset‘,
            layout: ‘column‘,
            items: [{
                // ... 省略
            }]
            }]
        }, {
            xtype: ‘fieldset‘,
            collapsible: false,
            frame: true,
            items: [{
                xtype: ‘anlysetestprojectgrid‘ // Form下嵌套grid
            }]
        }, {
            xtype: ‘hiddenfield‘,
            name: ‘id‘
        }];


        this.callParent(arguments);
    }
});


Grid代码:

Ext.define("Soims.view.application.AnlyseTestProjectGrid", {
    extend: ‘Ext.grid.Panel‘,
    alias: ‘widget.anlysetestprojectgrid‘,
    plugins: [Ext.create(‘Ext.grid.plugin.CellEditing‘, { clicksToEdit: 1 })],
    closable: false,
    initComponent: function () {
        this.columns = [
            {
                header: ‘拟提交测试数据‘,
                dataIndex: ‘intendCommitTestData‘,
                flex: 1,
                editor: { // 重点
                    allowBlank: false
                }
            }];

        this.callParent();
    }
});


这是ext4.2.1的一个bug

具体见http://www.sencha.com/forum/archive/index.php/t-279876.html?s=8633abd6266531666ee4c2be06a16f1a

本文出自 “技术人生” 博客,请务必保留此出处http://wangyuelucky.blog.51cto.com/1011508/1430029