PDA

View Full Version : Suspend Grid CellEdit



yuhanlee
9 May 2013, 5:32 AM
I have a grid with multiple CellEdit columns. For certain columns, when I unfocus, I will call an AJAX service to recalculate the data for the whole grid and repopulate the whole grid. It's working fine when I use mouse click to unfocus. However, when I use tab, the problem comes.

Finally, I found out that it is because when I TAB to the next column, the next column is also editable (CellEdit). Thus, the column immediately became a editable textfield, even before I can repopulate the whole grid with new data. I think this is because of the AJAX asynchronous behavior. The AJAX call takes a short while to process. During that shortwhile, the column already changed to an editable textfield. Thus, the new data is not being updated to that column. in the editable textfield, it will show the old data.

So, how to solve this?

yuhanlee
9 May 2013, 7:01 AM
So, i end up doing some dirty trick =_=

set the focus back to my current column and then set the grid value, and then set the focus to the next column
grid.editingPlugin.startEdit(rowIdx, colIdx);
//load data
grid.editingPlugin.startEdit(rowIdx, colIdx+1);

appreciate if anyone can share better solution.