怎样在ext的store中额外加入一条数据
怎样在ext的store中额外加入一条数据,不仅仅是添加到末尾,而是可以添加到任何位置?
假设你的grid和store都已经new好了,首先new一个Record
var p = new Record({
workRecordId:'',
project_id:'',
taskStageId:'',
workRecordContent:'',
workRecordPlanhours:'',
workRecordRealhours:'',
workRecordProgress:'',
workRecordRemark:''
});
2.将grid停止可编辑状态
grid.stopEditing();
3.向这个grid的store插入数据
store.insert(store.getCount(), p);//我项目里插入到最后一行,所以store.getCount(),这个数字类型可以自己选择插入到任意行都好用的
4.将这个grid重新设定为可编辑状态
grid.startEditing(0, 0);
通过以上4个步骤,就可以完成添加了,只写了几个步骤,可以试着做个例子出来,如果有问题,欢迎朝我要源码
使用store的insert( Number index, Ext.data.Record[] records )方法
你想哪就加哪..效果非常好 :wink: