Reputation: 6655
I'm used to jQuery where I would do $('pre').toggle()
. What's the most straighforward ExtJS equivalent of this? I'm using version 4.1.1.1.
I'm lost switching between Ext.fly
and Ext.dom.Query.select
.
Upvotes: 0
Views: 179
Reputation: 3645
You can use Ext.select(selector, [unique], [root]). For example:
Ext.select('pre').toggle();
More examples:
Ext.select ('div: first'); // select a first div
Ext.select ('div: last'); // select a last div
Ext.select ('div: even'); // fetch even div
Ext.select ('div: odd'); // fetch the odd div containing the 'bar'
Ext.select ('input: checked]'); // select all input c checked = true
Ext.select ('div {display = none}'); // select all the div with CSS-style display = none
Ext.select ('div {display! = None}'); // select all the div with CSS-style display! = None
Ext.select ('div {height% = 2}') // select all the div with CSS-style in which the height is divided into two
Ext.select ('div: not (form)') // fetch div, not containing a form
Ext.select ('div: has (a)') // fetch div, containing a link
Ext.select ('input: checked') // select all checked checkboxes
Selectors in Sencha docs: http://docs.sencha.com/extjs/4.1.1/#!/api/Ext.dom.Query
The Ext.fly() method is similar to Ext.get(), with the difference that it is optimized for garbage collection. The developers recommend using it in cases where there is no need to reuse the resulting DOM element.
Upvotes: 1