Define a Widget Event

Once an event has been defined it can be executed from with the JavaScript. Here a "select" event is fired by the graph when the user clicks an item. The event listener is added to the browser DOM. When the event fires an anonymous function is executed, and the fireItemSelected function can be executed. This will result in the equivalent event firing in the RDMLX.

// EVENT: select

google.visualization.events.addListener( this.m_Chart, 'select', function()

{

  var

    selectedItem = pThis.m_Chart.getSelection()[0];

    if ( selectedItem )

    {

      pThis.fireItemSelected( ( selectedItem.row + 1 ), pThis.m_DataTable.getValue( selectedItem.row, 1 ), pThis.m_DataTable.getValue( selectedItem.row, 0 ) );

    }

});