PDA

View Full Version : ComponentQuery: search tools array



htammen
24 Feb 2011, 9:03 AM
how can I find an item of the panels tools array via ComponentQuery?

This is my panel:

xtype: 'panel',
region: 'west',
collapsible: true,
collapseFirst: false,
flex: 0.35,
autoScroll: true,
id: 'lvPanel',
title: 'My Title',
tools: [
{
xtype: 'tool',
type: 'gear',
handler: function(e, target, panelHeader, tool){
var portlet = panelHeader.ownerCt,
el = portlet.getEl();

// simulate some gear activity
el.mask('Working...');
Ext.defer(el.unmask, 2000, el);
}
},
{
xtype: 'tool',
type: 'refresh',
id: 'toolRefresh'
}
],


I would like to get the tool item with the id "toolRefresh". Ive tried

Ext.ComponentQuery.query('#toolRefresh')
Ext.ComponentQuery.query('#lvPanel #toolRefresh') and
Ext.ComponentQuery.query('#lvPanel .tool')

Last one to get the entire tools array. Nothing worked

Querying


Ext.ComponentQuery.query('.tool')

retrieves all tool components at the page.

Animal
24 Feb 2011, 11:26 PM
It works for me. Remember that query returns an array.

I just went into the portal example and

Ext.ComponentQuery.query('#tool-1046')

returns an array containing the collapse tool of the grid (which is in portlet-1)

So does Ext.ComponentQuery.query('#portlet-1 #tool-1046')

htammen
26 Feb 2011, 2:04 PM
Ive downloaded PR2 today and tested again. No success.
When I debugged I noticed that the tools array is not enclosed in the components that are browsed through so the query function cannot find the toolRefresh tool.