Wednesday, 15 May 2013

extjs - Sencha Touch: searching components with classes with ComponentQuery() and down() -



extjs - Sencha Touch: searching components with classes with ComponentQuery() and down() -

i have problem , don't know if bug or misunderstood something. wanted search component specific class. example:

ext.define('test', { xtype: 'test', cls: ['cat', 'dog'] });

i wanted find component created in ext.container this.down('test[cls~=cat]') (i used ~= because component has multiple classes). got undefined or null (don't know anymore) result.

with ext.componentquery.query('test[cls~=cat]') find it.

why that? thought down() same ext.componentquery.query difference it's search scope not global.

i using current version of sencha touch.

no, doesn't work. can use

this.query('test[cls~=cat]')

or utilize this:

ext.componentquery.pseudos.hascls = function(items, cls) { var = 0, l = items.length, c, result = []; (; < l; i++) { var c = items[i]; if (c._cls && c._cls.indexof(cls) > -1) { homecoming c; } } homecoming undefined; };

and phone call like:

this.down(".component:hascls(cat)")

extjs sencha-touch

No comments:

Post a Comment