get data of selected rows in slickgrid

雨燕双飞 提交于 2019-12-01 05:44:50

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.

eliprodigy

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));
});

You can also use this line in the .each loop to pull the data from the dataView instead of using getData() from the grid object, since that seems to be inconsistent depending on the fork:

var selectedData = [],
    selectedIndexes;

selectedIndexes = _grid.getSelectedRows();
jQuery.each(selectedIndexes, function (index, value) {
    selectedData.push(_dataView.getItemById(value));
});
Emma Gasca
hObjMarcado  = ( grid.getSelectedRows());
for( var a_id in hObjMarcado ) {
    vres.push( dataview.getItem( hObjMarcado[a_id] ));
    //la opcion getItem obtiene el elemento especifico,
    //aun con filtro.
}
return vres;

If you access grid from other control like . click button

var selectRow = gridInstance.getSelectedRows();
alert(gridInstance.getDataItem(selectRow).columnName)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!