Change grid cell

I have a grid with 3 columns. Underneath I have text gadgets to edit the content of the grid lines. Not all the data is in the grid since there 20+ fields, so grid cells are not edittable.



When user changes something in the 3 columns, I grid.clearAll() and rebuild the grid. This could get slow for large lists.



Is there a way to change one cell in a row? I thought setUserData() could, unless I am doing it wrong.





Order Category Name

====================================

1 Apps MS Office

2 Spyware Spybot S&D





User selects second row. Goes to string gadget and changes Spyware to Anti-Spyware. Now change just that cell without rebuilding entire grid. Much faster.

Is there a way to change one cell in a row?
Sure
grid.cells(rowId,cellIndex).setValue(new_value);
or
grid.cells(rowIndex,cellIndex).setValue(new_value);

>>Now change just that cell without rebuilding entire grid. Much faster.
grid.cells2(1,1).setValue(“Anti-Spyware”);

This answer and the documentation are very poor!

First you say here that grid.cells setValue is used but in your actual example you use grid.cells2

In the documentation explorer under Excell API Reference the first example uses grid.cells(i,j) without any indication what i and j are and there is absolutely no mention of cells2 functions, in the above case cells2.setValue works but cells.setValue silently does nothing.  A little further down under Editing you use grid.cell(i,j). (singular cell) - is that correct?

How do we know when to use cells and when to use cells2?


grid.cells and grid.cells2 are both method to access cell objects ( they are aliases for cellById and cellByIndex methods )
>>in your actual example you use grid.cells2
I has not info about IDs used in real situation so used index based version of command (cells2), but in real situation , when you known ID of row in question , you will use ID based version of command (cells) because ID is more reliable parameter, which are constant for row ( index can be changed by sorting or some other operations )

>>How do we know when to use cells and when to use cells2?
Basically it is the same command, if you have ID - use cells, if you have index - use cells2 ( or convert index to ID by getRowId and still use cells )

cells(row_id, col)
gets dhtmlXGridCellObject object (if no arguments then gets dhtmlXGridCellObject object of currently selected cell)
Object: dhtmlXGridObject
Topic(s):
File required:dhtmlxgrid.js
row_id - row id
col - column index

cells2(row_index, col)
gets dhtmlXGridCellObject object
Object: dhtmlXGridObject
Topic(s):
File required:dhtmlxgrid.js
row_index - row index
col - column index