I am defining a button like this :
{
xtype : 'button',
reference : 'button1'
}
I want to get to be able to select it using this syntax :
this.lookupreference("button1");
and then fire a click event on it.
Is this syntax correct : this.lookupreference("button1").fireEvent("click");
?
If no, then how to do it using the lookupreference ?
Thanks !
the method is lookupReference not lookupreference.
Some important things to remember:
The reference cache is based on a controller. So you have to have a controller in the components hierarchy.
When I did this fiddle i noticed two things, first the button1.fireEvent('click') did not execute the handler method. The button had to have a 'click' event listener. Second, the fireEvent did not pass the button by default. That is the button would be the first argument of the event when the buttons is clicked. So I passed the button in the fireEvent call.