简体   繁体   English

查询JS Ext.data.Store

[英]Query JS Ext.data.Store

I am planning to use http://www.objis.com/formationextjs/lib/extjs-4.0.0/docs/api/Ext.data.Store.html to store a table and filter the data... For instance the table sales: Product | 我打算使用http://www.objis.com/formationextjs/lib/extjs-4.0.0/docs/api/Ext.data.Store.html来存储表并过滤数据...例如表销售:产品| Branch | 分公司 Quantity | 数量| Earning | 收入| ... Suppose the data for quantity and earning are range of values, such as: less than 100, between 101 and 200, etc. and I use a ComboBox for each column to filter the data: Product combobox, Branch combobox,... ...假设数量和收入的数据是值的范围,例如:小于100,介于101和200之间,等等。我对每一列使用一个ComboBox来过滤数据:Product组合框,Branch组合框。 。

My design has a global Store to hold the table, and one Store per ComboBox . 我的设计有一个全球性的Store来保存表,以及一个Store每个ComboBox I know I can use the event/listener Select in the ComboBox to apply the filters. 我知道我可以使用ComboBox的事件/监听器Select来应用过滤器。 Additional, use the datachanged of the global Store to set the data in the other stores. 另外,使用全局Storedatachanged在其他存储中设置数据。

My question is: How to get/select/extract a column from the global Store and applies distinct and sort operations to set the data in each combobox-store??? 我的问题是:如何从全局商店中获取/选择/提取列,并应用不同的排序操作来设置每个组合框商店中的数据?

Update 更新资料

Example http://jsfiddle.net/jQXf7/6/ 示例http://jsfiddle.net/jQXf7/6/

I worked out the solution using collect method of the store and using Ext.data.ArrayReader for the ComboBox Stores . 我使用商店的collect方法并为ComboBox Stores使用Ext.data.ArrayReader制定了解决方案。

  • Collect : Collects unique values for a particular dataIndex from this store. Collect :从此存储中收集特定dataIndex的唯一值。
  • Ext.data.ArrayReader : Data reader class to create an Array of Ext.data.Record objects from an Array. Ext.data.ArrayReader :数据读取器类,用于从Array创建一个Ext.data.Record对象的数组。

Solution: http://jsfiddle.net/jQXf7/10/ (simple implementation of one filter at the time) 解决方案: http : //jsfiddle.net/jQXf7/10/ (当时一个过滤器的简单实现)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM