Extjs中我用data.jsonStore从后台获取数据后.前台再往里面添加一条数据.
答案:1 悬赏:20
解决时间 2021-02-26 17:47
- 提问者网友:送舟行
- 2021-02-26 11:58
Extjs中我用data.jsonStore从后台获取数据后.前台再往里面添加一条数据.
最佳答案
- 二级知识专家网友:人類模型
- 2021-02-26 12:54
//定义类型,注意和你json返回的记录格式要一致
var MyRecordType = Ext.data.Record.create
([
{name: "id",type: "int"},
{name: "name", type: "string"}
]);
//要添加的记录
var oneRecord = new RecordType
({
id:0,
name: "张三"
});
//Store
var userStore = new Ext.data.Store({
//此处省略
})
userStore.load();
userStore.add(oneRecord);
var MyRecordType = Ext.data.Record.create
([
{name: "id",type: "int"},
{name: "name", type: "string"}
]);
//要添加的记录
var oneRecord = new RecordType
({
id:0,
name: "张三"
});
//Store
var userStore = new Ext.data.Store({
//此处省略
})
userStore.load();
userStore.add(oneRecord);
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯