PDA

View Full Version : HowTo ComponentQuery w/o dockedItems?



makana
18 Jun 2013, 2:54 AM
Hi,

I've got a question. How do I query components from a panel without including the dockedItems?

If I have a TabPanel for example and query


tabPanel.child('[isDockablePlaceholder!=true]');

I always get a result including the TabBar. What's special here maybe is that I want to query components, that do NOT have a specific property - 'isDockablePlaceholder' here.

Sure I can do (and I do - and I guess it's even faster)


tabPanel.items.findBy(function(item) {
return !item.isDockablePlaceholder;
});


but my question is, if it is generally possible to exclude dockedItems in child/down/query/etc.-methods?


When I look at the docs for "child" it says


Retrieves the first direct child of this container which matches the passed selector or component.
IMO, children of a container do not include dockedItems but only "items", since docked items are meant to be something special within a component, but not a child in terms of "items". But that's of course just my point of view and I'm sure there are reasons to consider docked items as children.

Regards

tvanzoelen
18 Jun 2013, 4:34 AM
If you search for components you might try the down function.

See for the documentation here.

http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.ComponentQuery

mankz
18 Jun 2013, 5:02 AM
Check the pseudo selectors (the 'not'' one perhaps)

http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.ComponentQuery

makana
18 Jun 2013, 8:01 AM
I did not recognize the not pseudo selector.

The following works:


tabPanel.child('[isDockablePlaceholder!=true]:not([dock])');


Thanks @mankz