在ExtJS中将数据附加到GridPanel [英] Appending data to GridPanel in ExtJS
本文介绍了在ExtJS中将数据附加到GridPanel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我遇到一个看似简单的问题:将数据附加到我的ExtJS网格面板。我有一个网格面板,并设置了一些初始数据。
I'm stuck with a seemingly simple problem: appending data to my ExtJS Gridpanel. I have a gridpanel with some initial data set up.
var myData = [['data1','data2']];
var myReader = new Ext.data.ArrayReader({}, [
{name: 'Col1'},
{name: 'Col2'},
);
var datastore = new Ext.data.Store({
data: myData,
reader: myReader
});
grid = new Ext.grid.GridPanel({
store: datastore,
...
etc
这是一切正常的工作。现在我想定期向这个gridpanel添加新数据(有一个函数生成数组)
但是我没有任何想法?
This is all working fine.Now i would like to periodically append new data to this gridpanel (there is a function that is generating arrays of data). However I cant get this to work. Tried datastore.add, but to no avail.
推荐答案
解决方案
你传给datastore.add是什么?
What did you pass to datastore.add?
尝试这样:
datastore.add(new datastore.recordType({
Col1: 'data3',
Col2: 'data4'
}));
这篇关于在ExtJS中将数据附加到GridPanel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文