1

我有一个 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'); 
4

0 回答 0