I have a dojo datagrid which cells I will like to change at will depending on changes in user choice. The store used for the grid is populated from multiple database tables. This particular feature is very central to the application I am working on as there are a lot of calculations which results affects other cells in the grid.

I figure it will be something like get the grid, get the row based on an index and then get the cell by name. However I have not been able to figure how to do this.

有帮助吗?

解决方案

To change the data displayed in a dojo datagrid, you need to update the grid's store instead. Suppose that you want to edit the cell of column 'Name' in the current selected row, first get the row's index:

var index = grid.selection.selectedIndex;

Then get the row:

var item = grid.getItem(index);

Update the cell:

var store = grid.store;
store.setValue(item, 'Name', 'Your value');

Finally, update the grid's display

grid.update();
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top