I have dhtmlx grid and I attach two events to it:
var click_flag = false;
dhxGrid.attachEvent("onRowDblClicked", function (rowId, cellIndex) {
click_flag = true;
...
});
dhxGrid.attachEvent("onRowSelect", function (rowId, cellIndex) {
if (!click_flag) {
...
}
});
But onRowSelect gets triggered always, even when I double click a row of the grid. Is there a way I can stop it from executing? I tried with click_flag but it doesn't work.
Caused by browser's behavior ( dbl-click action generates single click event as well ) You can separate both events with a bit of custom timing logic, like next
var click_timer;
dhxGrid.attachEvent("onRowDblClicked", function (rowId, cellIndex) {
if (click_timer) clearTimeout(click_timer);
... actual ondblclick code here ...
});
dhxGrid.attachEvent("onRowSelect", function (rowId, cellIndex) {
click_timer = window.setTimeout(function(){
... actual onrowselect code here ...
}, 250);
});