You are here: Web Apps with Visual LANSA > 14. Widgets and 3rd Party Integration > 14.1 Widgets > Define a Widget Event
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 this.m_Chart, 'select', function()



    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 ) );