使用ExtJS选择不包含某个ID的元素 [英] Selecting elements that do not contain a certain ID using ExtJS
问题描述
我尝试选择表单的所有< input>
元素,除了ID包含单词 foo
或 bar
。我该如何使用ExtJS 2.3.0?我尝试了以下操作:
I'm trying to select all the <input>
elements of a form except ones with IDs containing the words foo
or bar
. How can I do this using ExtJS 2.3.0? I've tried the following:
Ext.query("select,input:not([id*=foo][id*=bar])", "SomeForm");`
...工作。排除其中 foo
的ID似乎工作正常:
... but it doesn't work. Excluding IDs with foo
in them seems to work fine:
Ext.query("select,input:not([id*=foo])", "SomeForm")`
我只是不知道如何添加第二个ID子字符串。任何想法?
I'm just not sure how to add a second ID substring. Any Ideas?
推荐答案
不知道如何组合这样的选择器,但我想如果使用过滤器功能,第一个查询:
Not sure how to combine a selector like this but I think if you use the filter function you can filter out the first query:
Ext.DomQuery.filter(Ext.query('input:not([id*=foo])','SomeForm'),'input:not([id*=bar])');
请注意,我只是玩了一下,这个函数工作:
Notice that I just played around a bit more with this and that function works:
Ext.query('input:not([id*=foo]):not([id*=bar])');
但这给了我提出的同样的错误:
but this gives me the same error you mentionned:
Ext.query('input:not([id*=foo]):not([id*=bar])','SomeForm');
所以在我看来,像ExtJS查询函数的错误,属性选择器。
So it seems to me like a bug with the ExtJS query function when you pass a specific root with multiple attribute selectors.
这篇关于使用ExtJS选择不包含某个ID的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!