如何使用具有特定值的组合框查找容器

时间:2017-03-23 09:06:53

标签: extjs

请参阅ff:

主要容器:

xtype: 'container',
name: 'mainContainer',
items: [
    {
        xtype: 'myXtype',
        name: 'some1'
    },
    {
        xtype: 'myXtype',
        name: 'some2'
    },
    {
        xtype: 'myXtype',
        name: 'some3'
    }
]

myXtype:

Ext.define('blabla.MyXtype', function() {
....
alias: 'widget.myXtype',
items: [
    {
        xtype: 'combo',
        name: 'combo1'
    },
    {
        xtype: 'combo',
        name: 'combo2'
    },
    {
        xtype: 'combo',
        name: 'combo3'
    }
....
});

现在,我想找到包含具有特定值的精确组合的myXtype容器。说,我有值(test1,test2,test3)和ff myXtype及其值:

some1: { //not this, combo values not matching my values
    combo1: 'not this1'
    combo2: 'not this2'
    combo3: 'not this3'
},
some2: { //not this also, combo3 is null
    combo1: 'test1',
    combo2: 'test2',
    combo3: null
},
some3: { //should be this 1
    combo1: 'test1',
    combo2: 'test2'
    combo3: 'test3'
}

我已经尝试过这个,但这会引发 Invalid ComponentQuery selector 错误:

var found = mainContainer.down('![xtype=myXtype] combo[value=test1] combo[value=test2] combo[value=test3]');

我知道Extjs down()函数可以将CSS选择器作为参数但不幸的是,CSS中没有父选择器,对吧?

我还尝试过 jQuery :has()选择器而没有运气:

var found = mainContainer.down('[xtype=myXtype]:has(combo[value=test1], combo[value=test2], combo[value=test3])')

非常感谢任何帮助。

注意:有想法循环foreach myXtype然后再次循环它的combo个孩子,检查他们的价值观但我认为这不是很理想。另外,我想要一个 ExtJS 答案。

编辑:我选择了循环播放,但我会在此留下此问题以供日后参考。

Cheers!

0 个答案:

没有答案