如何强制使用extjs网格中的字段

时间:2013-09-25 19:10:04

标签: extjs

我有一个extjs网格如下。如何使字段成为必填字段(必填)? 我的网格中有文本字段如下。

当用户提交页面时,应显示该字段是必填字段的消息。

 var cm = new Ext.grid.ColumnModel([ 
    {
        id:'xpath',
        header: "Expression",
        dataIndex: 'xpath',
        width: 250,
        menuDisabled: true,
        editor: new fm.TextField({
            allowBlank: false
        })
     }
 ]);

     var grid = new Ext.grid.EditorGridPanel({
     store: store,
     cm: cm,
     width:530,
     height:140,
     autoExpandColumn:'xpath',
     frame:false,
     clicksToEdit:2,

     bbar: ['->',
            new Ext.Toolbar.Button({
            text: 'Add',
            handler : function(){
                        var p = new Identity({
                                languageId1:'',
                                xpath: ''
                            });
                            grid.stopEditing();
                            store.insert(0, p);
                            grid.startEditing(0, 0);
                           setTimeout(function(){Ext.getCmp('languageId1').setValue('XPath');alert("Helloeee")},150);
                    }
            }),
            new Ext.Toolbar.Button({
            text: 'Delete',
            handler : function(){
                        grid.stopEditing();
                        var m = grid.selModel.getSelectedCell();
                        store.remove(store.getAt(m[0]));
                        grid.startEditing(0, 0);
                       }
            })
     ]
 });
grid.render('mask-grid'); 

0 个答案:

没有答案