开发者

Ext JS load store

开发者 https://www.devze.com 2023-04-05 12:13 出处:网络
I am facing a problem about reload store for grid. var all = Ext.create(\'Ext.data.Store\', { model:\'LiveLogModel\',

I am facing a problem about reload store for grid.

var all = Ext.create('Ext.data.Store', {
model:'LiveLogModel',
proxy: {
    type: 'memory',
    reader: {
        type: 'json',
        root: 'items'
    }
} 
});
all.insert(0,newRecords);

Here is my store. data of the store is added dynamically.开发者_开发技巧 The problem is after while I want to refresh grid for changing row colour in the grid. So I need to reload the store. However I cannot call all.road(). "Cannot read property 'length' of undefined" error appeared.

What's the problem here?


In your reader definition you need to specify "totalProperty", and other properties as well. and your json should have such attributes.

example:

reader: {
    totalProperty : 'total',
    successProperty : 'success',
    idProperty : 'id',
    root : 'data',
    messageProperty : 'message'
}
0

精彩评论

暂无评论...
验证码 换一张
取 消