Search code examples
javascriptyuievent-bubblingyui-datatable

How do I cancel event bubbling in a YUI DataTable?


I am trying to create a YUI 2.8.1 DataTable with a checkbox column. When the user selects the row it should highlight, but not when the user checks the checkbox.

I'm trying to suppress the rowClickEvent by setting cancelBubble = true in the checkboxClickEvent, but the YUI library ignores this. How do I prevent the rowClickEvent from firing?

this.testDataTable.subscribe("checkboxClickEvent", function (oArgs)
{
    var elCheckbox = oArgs.target;
    var oRecord = this.getRecord(elCheckbox);
    oRecord.setData("check", elCheckbox.checked);
    oArgs.event.cancelBubble = true; //Event bubbles anyway
});

Solution

  • return false from the checkboxClickEvent