Extjs在网格中显示自定义行

时间:2014-04-14 13:06:25

标签: extjs extjs3

我正在使用Ext JS 3.2。我有一个网格。现在我想自定义我现有的网格。我想将硬编码值添加为row0,但它不起作用

以下是我的代码

我的商店

var store = new Ext.data.Store({
                    id : 'user',
                    proxy : proxy,
                    reader : reader,
                    writer : writer, // <-- plug a DataWriter into the store
                    url: 'cat/view.action?catid='+catid_para+'&teaid='+teaid_para+'&flag='+0,
                    remoteSort: true,

                    remoteSort: true,
                    autoSave : false,

                // <-- false would delay executing create, update, destroy
                // requests until specifically told to do so with some [save]
                // buton.
                });




   var record = new SiteUtility({
                id:'0',
                fname:'4',
                lname:'3444',
                attandance: 'G',

            });
     var parent_grid=Ext.getCmp('org_grid');
            parent_grid.getStore().insert(0,record);
          //  store.save();
           //parent_grid.getView().refresh();

            store.load({params:{start:0, limit:10}}); 

由于

2 个答案:

答案 0 :(得分:0)

在这里你可以看到如何做到这一点。您需要先获取recordType并创建新记录:

var recordType = store.recordType; 
var nullRecord = new recordType({
    id: '1',
    name: "4",
    lname: "4",
    age: "2",
    remarks:"Remarks"
}, null);
store.insert(0, nullRecord);

您可以查看Ext Docs

答案 1 :(得分:0)

试试这个:

store.load({params:{start:0, limit:10}, callback: function(){
     var record = new SiteUtility({
            id:'0',
            fname:'4',
            lname:'3444',
            attandance: 'G'
        });

        store.insert(0,record);
}});