Reputation: 302
I want to use Ext.ComponentQuery.query()
to query name of button that contain some path of name.
Assume I have 4 button with name declare as 'edit_btn', 'add_btn', 'add2_btn' and 'edit2_btn'
Then I use query.
Ext.ComponentQuery.query("button[name='*edit*']");
I should get ''edit_btn'' and ''edit2_btn'' button.
Ext.ComponentQuery.query("button[name='*add*']");
I should get ''add_btn'' and 'add2_btn' button.
Or I can use regex in Ext.ComponentQuery.query()
command?
If can, How to use it?
Upvotes: 3
Views: 9038
Reputation: 16140
It's not implemented. I looked at the source code, and there is only equality operator implemented. Hovewer it's easy to extend it (see filterByAttribute
in ComponentQuery.html file), but you must copy all the code from source, because it's implemented as singleton.
Another way is to select buttons which have name attribute and filter later, eg:
Ext.Array.filter(
Ext.ComponentQuery.query('button[name]'),
function(c){ return /^add/.test(c.name); }
)
Upvotes: 10