in Education by
Just wondering is there a way to handle that in Sencha Touch. One store and after applying different filters, the store can be used for different places. For example: I have a store: Ext.regModel('abc', { fields: [{name: 'tid', type: 'int'}, {name: 'name', type: 'string'}, {name: 'parent', type: 'int'}] }); var store = new Ext.data.Store({ model: 'abc', proxy: { type: 'ajax', url : 'read.php', reader: { type: 'json', root: 'items', fields: ['tid', 'name', 'parent'] } }, autoLoad: true, }); And in a FormPanel, it has two selectfields: items: [ { xtype: 'selectfield', name : 'One', label: 'Category', // store: store, <-- Load the whole store store: function(){ store.filter('name', 'digital'); <-- Load part of store }, displayField: 'name', valueField: 'tid' },{ xtype: 'selectfield', name : 'Two', label: 'subCategory', // store: store, <-- Load the whole store store: function(){ store.filter('parent', 1); <-- Load part of store }, displayField: 'name', valueField: 'tid' },{ ...} ] JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Afraid not, You need two instances of your store. Why not extend your store, just to make it pre-configured like this: Ext.regModel('abc', { fields: [{name: 'tid', type: 'int'}, {name: 'name', type: 'string'}, {name: 'parent', type: 'int'}]}); MyStore = Ext.extend(Ext.data.Store, { constructor: function(config) { config = Ext.apply({ model: 'abc', proxy: { type: 'ajax', url : 'read.php', reader: { type: 'json', root: 'items', fields: ['tid', 'name', 'parent'] } }, autoLoad: true, }, config); MyStore.superclass.constructor.call(this, config); } }) Then you can use multiple instances of your store and filter them how you want: items: [ { xtype: 'selectfield', name : 'One', label: 'Category', store: new MyStore(), //1st instance of MyStore displayField: 'name', valueField: 'tid', listeners : { 'render' : function(){ this.store.filter('name', 'digital'); } } },{ xtype: 'selectfield', name : 'Two', label: 'subCategory', store: new MyStore(), //2nd instance of MyStore displayField: 'name', valueField: 'tid', listeners : { 'render' : function(){ this.store.filter('parent', 1);; } } },{ ...} ]

Related questions

0 votes
    I have a model and store that take in values from my form fields. My form contains a textfield, ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    I am beginner for the cocos2d, but thought that cocos2d derived from the openGL. Actually I am having basic ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 17, 2022 in Education by JackTerrance
0 votes
    How to insert different types of slides and images into the slides and apply animation and transition on them Select the correct answer from above options...
asked Dec 24, 2021 in Education by JackTerrance
0 votes
    What is Git stash apply? How is it different from Git stash pop?...
asked Nov 4, 2020 in Technology by JackTerrance
0 votes
    Which of these class object uses the key to store value? (a) Dictionary (b) Map (c) Hashtable (d) ... Collections Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    Which of these is a class which uses String as a key to store the value in object? (a) Array (b) ... The Collections Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    Which of these class object uses the key to store value? (a) Dictionary (b) Map (c) Hashtable (d ... programming questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    Which of these is a class which uses String as a key to store the value in object? (a) Array ... java programming questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
0 votes
    How is the Context Filter different from other Filters in Tableau?...
asked Oct 29, 2020 in Technology by JackTerrance
0 votes
    What Are the Filters? Name the Different Filters in Tableau....
asked Mar 29, 2021 in Technology by JackTerrance
0 votes
    What are the different filters in Tableau? Differentiate....
asked Feb 5, 2021 by JackTerrance
0 votes
    Can we use different filters in different pages?...
asked Nov 21, 2020 in Technology by JackTerrance
0 votes
    What Are the Filters? Name the Different Filters in Tableau....
asked Nov 1, 2020 in Technology by JackTerrance
0 votes
    i have a UiBarButton item in my Toolbar.i need to deactivate the user touch interaction in UiBarButton. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 4, 2022 in Education by JackTerrance
...