I have just modified the JSONP example to try and display different content when I click on some test buttons in a toolbar.
However, the handler events for the toolbar seem to be firing when the page loads and then do not fire when you click on the buttons. The panel definition is:

The getIssues function is declared above this - I have an alert in it and it displays the data and year parameters, 1991 and 1978 when the page loads.

Am I doing something wrong here?

Robert Jones

TommyMaintz

6 Jul 2010, 10:26 AM

You are actually calling the handler methods (by adding the parentheses). Try just using getIssues, and then based on the button that is clicked you decide the year.

robertj98

6 Jul 2010, 10:37 AM

Thanks - I can see what what was happening now and the page is working OK. I called 2 different functions which displayed the years.
Where would you test for the button that was pressed? Is there a last event property or something that could be examined?

Robert Jones

TommyMaintz

6 Jul 2010, 1:36 PM

The btn is passed to the handler as the first argument. Also the default scope references the button, so inside your handler 'this' should point to the button that was pressed.

robertj98

7 Jul 2010, 1:05 AM

Thanks again.

Got it - used the parameter to get the buttons properties - using btn.getText() and called methods like btn.disable() - also added custom property to the button config definition ('pyear') and accessed this as btn.pyear within the handler function.