javascript - Iterate Over Ext JS Form Components of Particular Type -


i have ext.form.panel contains mixture of "typical" fields: textfield, combobox, checkboxfield, , like. each combobox has forceselection : true , - therefore - associated store. goal loop on each of fields in panel, determine whether combobox, "some stuff" - i.e. load associated store.

two questions (each holding hand of over):

  1. is possible ext.each on particular "type" of component on panel? or, approach problem differently: possible select group of components matching particular type?
  2. if not, how determine type of component @ run-time?

currently, using list of identifiers, iterating on each identifier, , running query against panel, e.g.

var comboboxids : [     'dogs',     'cats',     'fish' ];  ext.each(comboboxids, function(comboid) {     var combobox = panel.querybyid(comboid);      //....  }); 

the above being simplistic reduction.

use query method need, , iterate on array:

var combos = panel.query('combobox[forceselection=true]');  (var = 0; < combos.length; i++) {     var combo = combos[i];     ... } 

more on componentquery syntax: http://docs-origin.sencha.com/extjs/5.1/5.1.0-apidocs/#!/api/ext.componentquery