简体   繁体   中英

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 | 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,...

My design has a global Store to hold the table, and one Store per ComboBox . I know I can use the event/listener Select in the ComboBox to apply the filters. Additional, use the datachanged of the global Store to set the data in the other stores.

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/

I worked out the solution using collect method of the store and using Ext.data.ArrayReader for the ComboBox Stores .

  • Collect : Collects unique values for a particular dataIndex from this store.
  • Ext.data.ArrayReader : Data reader class to create an Array of Ext.data.Record objects from an Array.

Solution: http://jsfiddle.net/jQXf7/10/ (simple implementation of one filter at the time)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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