Looks like we can't reproduce the issue or there's a problem in the test case provided.
-
Sencha Premium Member
!= Selector (not equals) doesn't work
Ext version tested:
Browser versions tested against:
Description:
- Query a form panel for fields that do not match an attribute
Steps to reproduce the problem:
- var results = form.query("field[inputType!='hidden']");
The result that was expected:
- an array with all the fields that are not inputType "hidden"
The result that occurs instead:
- returns an array of only the fields with inputType "hidden"
- in other words the same as :
- var results = form.query("field[inputType='hidden']");
Test Case:
http://jsfiddle.net/dbVdJ/
-
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])');
Twitter - @evantrimboli
Former Sencha framework engineer, available for consulting.
As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.
-
Sencha Premium Member
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"
-
dom.Query and ComponentQuery are not the same thing.
Twitter - @evantrimboli
Former Sencha framework engineer, available for consulting.
As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.
-
Sencha Premium Member
My bad...
But your example returns all the fields
http://jsfiddle.net/dbVdJ/2/
Code:
form.query(":not([hidden])");
or
Code:
form.query("field:not([hidden])");
-
Yes, I just copied that from the code somewhere, you'd still need to check the inputType.
Twitter - @evantrimboli
Former Sencha framework engineer, available for consulting.
As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.
-
Sencha Premium Member
excellent thank you
Here is the solution:
Code:
form.query("field:not([inputType=hidden])");
-
Sencha Premium Member
just for others:
multiple chains (i.e. not hidden and not label = "hello2"):
form.query("field:not([inputType=hidden]):not([fieldLabel='hello2'])");