worthlutz
21 Jan 2013, 6:24 AM
I have defined a top level class:
Ext.define('MyApp.view.MyClass', {
extend: 'Ext.tree.panel',
alias: 'widget.mytreepanel'
...
});
I then use this view as such:
Ext.define('MyApp.view.MyView', {
extend: 'Ext.tab.panel',
...
items: [
{
xtype: 'panel',
title: 'Tree1',
items: [
{
xtype: 'mytreepanel',
newAttr: 'treepanel'
}
]
},{
xtype: 'panel',
title: 'Tree2',
items: [
{
xtype: 'mytreepanel',
newAttr: 'treepanel'
}
]
}
],
...
});
Now when I try to gather all of the tree panels with
var trees = Ext.ComponentQuery.query('mytreepanel');
console.log('number of trees = ' + trees.length);
I get 3 trees. I only expected the 2 that were in my tab panel. Is this the expected result?
If I give an additional attribute ('newAttr' above) to the two which are used in the tab panel when they are instantiated, I can query with that attribute and get only those two.
var trees = Ext.ComponentQuery.query('mytreepanel [newAttr="treepanel"]');
console.log('number of trees = ' + trees.length);
An explanation of what I'm seeing by someone who understands better that I would be appreciated.
Thanks,
Worth
Ext.define('MyApp.view.MyClass', {
extend: 'Ext.tree.panel',
alias: 'widget.mytreepanel'
...
});
I then use this view as such:
Ext.define('MyApp.view.MyView', {
extend: 'Ext.tab.panel',
...
items: [
{
xtype: 'panel',
title: 'Tree1',
items: [
{
xtype: 'mytreepanel',
newAttr: 'treepanel'
}
]
},{
xtype: 'panel',
title: 'Tree2',
items: [
{
xtype: 'mytreepanel',
newAttr: 'treepanel'
}
]
}
],
...
});
Now when I try to gather all of the tree panels with
var trees = Ext.ComponentQuery.query('mytreepanel');
console.log('number of trees = ' + trees.length);
I get 3 trees. I only expected the 2 that were in my tab panel. Is this the expected result?
If I give an additional attribute ('newAttr' above) to the two which are used in the tab panel when they are instantiated, I can query with that attribute and get only those two.
var trees = Ext.ComponentQuery.query('mytreepanel [newAttr="treepanel"]');
console.log('number of trees = ' + trees.length);
An explanation of what I'm seeing by someone who understands better that I would be appreciated.
Thanks,
Worth