Retrieving data from cells in SlickGrid

What method do I use for SlickGrid to get the contents of a cell? For example:

... grid = new Slick.Grid($("#myGrid"), data, columns, options); grid.onAddNewRow = function(item,colDef) { grid.removeRow(data.length); data.push(item); grid.updateRowCount(); grid.render(); } grid.onCurrentCellChanged = function(args){ // get cell content! }; ... 

Thanks in advance!

+6
javascript jquery jquery-plugins slickgrid
source share
2 answers

The grid directly changes the data source, so the changes will be applied to the "data". The onCurrentCellChanged event is fired when the user changes the active / selected cell and receives {row: currentRow, cell: currentCell} as a parameter. To get the cell data, you can use data[args.row][grid.getColumns()[args.cell].field] if you use the column.field field to access the data, and not to any format that receives the data in some other way.

+7
source share

grid.onCurrentCellChanged seems to have changed to grid.onActiveCellChanged.subscribe in 2.0

+2
source share

All Articles