开发者

Ext JS load store

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜