如何从 ExtJS Store 检索 JSON 数据数组 [英] How to retrieve JSON Data Array from ExtJS Store
问题描述
是否有一种方法可以让我完全按照加载数据的方式在 ExtJS 网格面板中返回存储的数据:
Is there a method allowing me to return my stored data in an ExtJS Grid Panel exactly the way I loaded it using:
var data = ["value1", "value2"]
Store.loadData(data);
我想要一个用户选项来重新加载网格,但需要考虑对商店的更改.用户可以进行更改并且网格会动态更新,但是如果我重新加载网格,即使数据库已使用新更改进行更新,也会显示最初加载的数据.我宁愿不重新加载页面,而是让他们使用新更改的存储重新加载网格数据本身.
I would like to have a user option to reload the Grid, but changes to the store need to be taken into account. The user can make changes and the grid is dynamically updated, but if I reload the grid, the data that was originally loaded is shown even though the database has been updated with the new changes. I would prefer not to reload the page and just let them reload the grid data itself with the newly changed store.
我想我正在寻找这样的东西:
I guess I'm looking for something like this:
var data = Store.getData();
//data = ["value1", "value2"]
说到底.或者是否有其他方法可以使用我不知道的新数据刷新网格.即使使用代理仍然使用原始"数据,而不是新存储.
after its all said and done. Or is there a different way to refresh the grid with new data that I am not aware of. Even using the proxy still uses the "original" data, not the new store.
推荐答案
Store.getRange()
似乎正是您要搜索的内容.它将返回您 Ext.data.Record[]
- 记录数组.如果不传递任何参数,则返回所有记录.
Store.getRange()
seems to be exactly what you are searching for. It will return you Ext.data.Record[]
- array of records. If no arguments is passed, all the records are returned.
这篇关于如何从 ExtJS Store 检索 JSON 数据数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!