javascript - Filtering combobox not working for common store combos -
i using extjs 2.3
. have 3 comboboxes following stores.
here, combo2 , combo3 share same store.
following combo stores-
combo1 store:
vice president
manager
employee
student
combo2 , combo3 store:
assignments
meetings
salary
now requirement is, if 'student' selected combo1, 'salary' should filtered out combo2 , 3 (it should not display 'salary' option)
i doing following code on change listener of combo1-
listeners: { change: function(combo, record, index) { var combo1val = combo.value; // give selected value correctly this.filtercombo(combo1val , combo2); this.filtercombo(combo1val , combo3); } }
and function body
filtercombo: function (combo1val , combo) { if (combo1val == 'student') { combo.store.filterby(function (record) { return record.get('text') != 'salary'; }); } else { combo.store.clearfilter(); } }
the problem here first time when select student combo1, 'salary' option disappears combo2. then, when expand combo3, displays salary option there, , again whwn click on combo2, again displays 'salary' option. somehow filter not working.
can tell doing wrong here.
you can try in combo2
listeners: { expand: function(combo) { combo.store.clearfilter(); if (combo1val == 'student') { //filter } } }
Comments
Post a Comment