а

Potential Issue with grid, 'CellClick' event and edit mode


#1

Hi,
I’m currently testing dhtmlx for one of our in-house development.

I made some tests using version 6.0 of grid.

I hit a strange behavior and just wanted to report it, in case it is a bug.
What I tried to achieve is to:

  • Put a cell in edit mode only by clicking the cell (simple click, not doubleclick default behavior)
  • Keep track of the last selected cell
  • Highlight the selected cell

The JS added looks like:

.myCustomClass{ background:greenyellow; }

For my testing, it works as expected, unless when I click on a cell with a “date” format and then click on another cell after.

What happens is:

  • click on a cell with a “date” format
  • the cell gets the blue frame (default behavior)
  • the cell gets my custom style (green background)
  • date time picker opens
  • while the date time picker is opened, I click in another cell
  • the cell with the “date” format loose the edit mode (blue frame disappear, custom style removed)
  • the cell which gets focus enter edit mode
  • It gets the blue frame (default behavior)
  • It gets my custom style (green background)
    BUT
  • the date from the previously selected “date” cell is copied in the newly selected cell.

All is fine for me except the last point above. The existing data in the cell is lost.

My point is not to discuss if what I tried to do is clever or not or can be achieved another way. It is just for testing. It is only to report a potential underlying bug.


#2

Please, try to call the edit method with a timeout:

grid.events.on("CellClick", function(row,column,e){
     	setTimeout(function(){grid.edit(row.id,column.id)})
});

#3

This works great with a delayed execution, but, as said, my goal was mostly to report the behavior, in case of an underlying bug.

Anyway, thx for the tip.