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.get开发者_如何转开发Record(elCheckbox);
oRecord.setData("check", elCheckbox.checked);
oArgs.event.cancelBubble = true; //Event bubbles anyway
});
return false from the checkboxClickEvent
I've worked around the issue by setting a flag to suppress row click, but I'd still like to know how to cancel the bubble "properly."
suppressHighlight = false;
this.testDataTable.onEventRowClick = function (oArgs)
{
...
if (!suppressHighlight)
{
...
}
suppressHighlight = false;
};
this.testDataTable.subscribe("rowClickEvent", this.testDataTable.onEventRowClick);
this.testDataTable.subscribe("checkboxClickEvent", function (oArgs)
{
var elCheckbox = oArgs.target;
var oRecord = this.getRecord(elCheckbox);
oRecord.setData("Check", elCheckbox.checked);
suppressHighlight = true;
});
精彩评论