-
12 Nov 2012 4:10 AM #1
!= Selector (not equals) doesn't work
!= Selector (not equals) doesn't work
Ext version tested:- Ext 4.1.1.rc1
- FF16
- Query a form panel for fields that do not match an attribute
- var results = form.query("field[inputType!='hidden']");
- an array with all the fields that are not inputType "hidden"
- returns an array of only the fields with inputType "hidden"
- in other words the same as :
- var results = form.query("field[inputType='hidden']");
http://jsfiddle.net/dbVdJ/
-
13 Nov 2012 2:56 AM #2
This isn't a bug, the != operator isn't defined, nor it is listed in the docs. Similar to css selectors, it's intended that you use the :not selector:
Code:cq.query(':not([hidden])');Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
13 Nov 2012 3:31 AM #3
Thanks for your reply.
Unfortunately it is listed in the documentation:
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.dom.Query
E[foo!=bar] attribute "foo" does not equal "bar"
-
13 Nov 2012 3:36 AM #4
dom.Query and ComponentQuery are not the same thing.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
13 Nov 2012 4:36 AM #5
My bad...
But your example returns all the fields
http://jsfiddle.net/dbVdJ/2/
orCode:form.query(":not([hidden])");
Code:form.query("field:not([hidden])");
-
13 Nov 2012 1:14 PM #6
Yes, I just copied that from the code somewhere, you'd still need to check the inputType.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
13 Nov 2012 1:19 PM #7
excellent thank you
Here is the solution:
Code:form.query("field:not([inputType=hidden])");
-
15 Nov 2012 12:28 PM #8
just for others:
multiple chains (i.e. not hidden and not label = "hello2"):
form.query("field:not([inputType=hidden]):not([fieldLabel='hello2'])");
Looks like we can't reproduce the issue or there's a problem in the test case provided.


Reply With Quote