Menu

Hook GWT method to 'onclick' on menuItem in Export Button

2013-02-22
2013-03-05
  • Rasmus Nielsen

    Rasmus Nielsen - 2013-02-22

    Hi,

    I have added an extra menu item to the Export button, which I want to use for exporting to Excel. My problem is how I hook a GWT method to the onclick method of the menu item. I have tried:

    setOption("onclick", "window.alert('test')");
    (here Im just trying to show an alert, but I want to call a GWT method)

    but im getting an error that says:

    Uncaught JavaScript exception [TypeError: a.onclick.apply is not a function]...

    which means that Im not using the right syntax to add the callback method. Anyone suggestions?

    Thanks :)

     
  • Shawn Quinn

    Shawn Quinn - 2013-03-05

    Unfortunately, I don't believe GWT Highcharts would currently support the ability to hook up a custom event handler when the "Export" button is clicked. It's on the TODO list, so if anyone would like to contribute - please let me know! Essentially, the "Exporting" Java type needs to support the Highcharts "buttons" configuration option, and then custom event handlers need to be wired up to the "exporting.buttons.exportButton.onclick" option.

    In the meantime, you'd either need to wire this up on your own (likely using a scheduledDeferred) to wire your own event into the DOM element with id "exportButton", or customize "BaseChart.java" to support this in the "nativeRenderChart()" method.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.