Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Just for the sake of completeness</strong> (and because <em>Member Expressions</em> can crash the query)</p> <p>As <a href="https://stackoverflow.com/users/1774881/existdissolve">@existdissolve</a> stated you can archive something similar (not the same!) of a wildcard with the use of a <strong><em>Member Expression</em></strong> like in your case</p> <pre><code>Ext.ComponentQuery.query('button &gt; menu &gt; menuitem{text.search("Welcome")!=-1}'); </code></pre> <p><em>This will try to perform the native JS search operation on the text property of any found menuitem. No matter if this property exist (or the method) which brings me to the main issue of Member Expressions</em></p> <p><strong>What you need to know about Member Expressions</strong></p> <p>You can use a <em>Member Expressions</em> on nearly every selector but they <strong>need</strong> to exist on that selector or you end up with a exception which aborts the query (totally, like a exception does). </p> <p>Here's a simple example. Let's say you want to find a button by it's text. That should be no problem, all buttons need a text, didn't they? This works for quite a time till your customer complains that some buttons don't need text a simple image would be enough. You have forgotten about the query thing and add the button and suddenly parts of your application stop working while you end up with a exception like</p> <blockquote> <p><em>Uncaught TypeError: Cannot call method 'search' of undefined</em></p> </blockquote> <p>You can try it yourself in this <strong><a href="http://jsfiddle.net/sran/9kPsY/" rel="nofollow noreferrer">JSFiddle</a></strong> example. Try 'find me' and after that hit the 'add image button' and try it again. </p> <p><strong>Why does this happen?</strong> The <code>Ext.ComponentQuery</code> test neither if property exist nor if the expression exist which can quickly lead to a total fail of the query.</p> <p>Yes, the example above is simple and you may find the source of the error real quick but it can also be completely different.</p> <p><strong>What now?</strong> I don't want to say to say that you should not use a <em>Member Expression</em> but you really need to care about the side effects that you may face.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload