Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get data of selected rows in slickgrid

I have a slickgrid in which some rows are hidden by a filter (DataView).

When I now call the getSelectedRows method of the grid I get the indices of the visibly selected rows. But I need the actual data of the selected rows.

like image 846
Preli Avatar asked Oct 30 '11 10:10

Preli


2 Answers

You must do something like this:

var selectedData = [],
    selectedIndexes;

selectedIndexes = _grid.getSelectedRows();
jQuery.each(selectedIndexes, function (index, value) {
  selectedData.push(_grid.getData()[value]);
});

Right now the selectedData variable contains data for selected rows.

like image 162
matma Avatar answered Oct 04 '22 06:10

matma


You have a mistake. It needs to be "getDataItem" and not "getData".

var selectedData = [],enter code here`selectedIndexes;

selectedIndexes = _grid.getSelectedRows();
jQuery.each(selectedIndexes, function (index, value) {
    selectedData.push(_grid.getDataItem(value));
});
like image 41
eliprodigy Avatar answered Oct 04 '22 06:10

eliprodigy