PDA

View Full Version : Get subset of store



lobosan
19 Dec 2011, 7:51 AM
Hi everyone,

How can i use the same json store in many combos of a form, for example



{"success":true,
"data":[
{"id":1,"description":"object1", "group":"group1"},
{"id":2,"description":"object2", "group":"group1"},
{"id":4,"description":"object3", "group":"group2"},
{"id":5,"description":"object4", "group":"group2"},
{"id":6,"description":"object5", "group":"group3"},
{"id":7,"description":"object6", "group":"group3"}
]}


So in my form i want to have 3 combos, each of them with different registers, depending on the group field, but based on the same store

Thanks in advance for any help

tobiu
19 Dec 2011, 8:33 AM
3 combos with one store share the filters, so it is not a good idea if they are editable.


triggerAction: 'all'


does help a bit.

i recommend to use 3 stores, load one via ajax and fill the other two locally with content on the load event of the first store. you can use Ext.define() to create a store class and instanciate it 3 times.

lobosan
19 Dec 2011, 11:47 AM
3 combos with one store share the filters, so it is not a good idea if they are editable.


triggerAction: 'all'


does help a bit.

i recommend to use 3 stores, load one via ajax and fill the other two locally with content on the load event of the first store. you can use Ext.define() to create a store class and instanciate it 3 times.

Hi Tobias, thanks for answer

I'm actually calling independent stores, but the problem is that i'm doing 20 queries to the server, and the time to load the form is too much, so i was thinking to call just one store and filter it by group in the client, and show a subset for each combobox.

If you have other approach i really appreciate it