Author Topic: BUG: rowClick and rowDblClick when updating a row  (Read 383 times)

jplevene

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 131
    • View Profile
BUG: rowClick and rowDblClick when updating a row
« on: January 19, 2024, 01:14:51 am »
Code: [Select]
rowClick: function(event, ui) {
console.log("rowClick");
// When a row is clicked, select or deselect the check box.  Must be a data row
if(!empty(ui.rowData))
{
var checked = ui.rowData["state"];
// Update the check box.  This causes the issue !!!!
that.infoGrid.pqGrid("updateRow", {rowIndx:ui.rowIndx, newRow:{"state":!checked} });
}
},
rowDblClick: function(event, ui) {
console.log("rowDblClick");
},

The call to updateRow in rowClick prevents the rowDblClick from being triggered.

The idea of rowClick is that a click on the row (not just the check box), selects/unselects the check box.

jplevene

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 131
    • View Profile
Re: BUG: rowClick and rowDblClick when updating a row
« Reply #1 on: January 19, 2024, 05:57:48 pm »
Is there another way to select/deselect the check box with a row click without using "updateRow" that will still trigger the double click on a row event?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6307
    • View Profile
Re: BUG: rowClick and rowDblClick when updating a row
« Reply #2 on: January 19, 2024, 10:33:13 pm »
updateRow updates the DOM of the row, hence 2nd click is registerd as 1st click on new row and rowDblClick is not fired.

As workaround you can use a timeout of 500ms to wait for another click before calling updateRow

or

Code: [Select]
ui.rowData.state = !ui.rowData.state.
grid.refreshCell(...) //refresh the checkbox cell.