Hiya,
I have some designer generated toolbar UI like so:
Code:
Ext.ns('SBS.Websites.PP3');
SBS.Websites.PP3.MapPanelToolbarUi = Ext.extend(Ext.Toolbar, {
initComponent: function() {
this.items = [
{
xtype: 'button',
text: 'Find a Location'
},
{
xtype: 'button',
text: 'Find Nearest Unit'
},
{
xtype: 'tbseparator'
},
{
xtype: 'button',
text: 'Reset Map',
ref: 'btnResetMap'
},
{
xtype: 'tbfill'
},
{
xtype: 'splitbutton',
text: 'Map Options',
menu: {
xtype: 'menu',
items: [
{
xtype: 'menucheckitem',
text: 'Show Traffic',
ref: '../../checkShowTraffic'
}
]
}
}
];
SBS.Websites.PP3.MapPanelToolbarUi.superclass.initComponent.call(this);
}
});
And in my own js file I am now trying to reference the toolbar items by their ref values so I can hook up some event handlers:
Code:
initComponent: function() {
var config={};
Ext.apply(this, config);
Ext.apply(this.initialConfig, config);
SBS.Websites.PP3.MapPanelToolbar.superclass.initComponent.call(this);
// Find the top element (should be the viewport) and use it to set appHub
var topEl=this;
while(topEl.ownerCt!==undefined) { topEl=topEl.ownerCt; }
this.appHub=topEl.appHub;
//Toolbar button listeners...
this.btnResetMap.on('click', this.ResetMap, this);
//doesnt work...
this.checkShowTraffic.on('click', this.ShowTraffic, this);
}
But I am unable to get a reference to the Show Traffic menucheckitem I have in my UI code by looking up via the ref property. Am I better off just giving it ID and grabbing it that way?
Can someone please assist?
Thanks,
Rob