bencripps / react-redux-grid

A React Grid/Tree Component written in the Redux Pattern
http://react-redux-grid.herokuapp.com/
MIT License
446 stars 63 forks source link

incorrect selection of indexes when selecting row #225

Open RodriFS-InflightVR opened 5 years ago

RodriFS-InflightVR commented 5 years ago

Hi, Ben. I recently found out that you can do lazy-loading of the grid when you have a great amount of data with "infinite = true". However, when you enable lazy-loading and select rows, the array of indexes of selected rows have incorrect values.

I was able to get the correct indexes by doing:

let selection = this.props.gridSelection.get(this.props.gridConfig.stateKey)
let selectionData = selection.toJS();
let selectionIndexes = Object.keys(selectionData).map(key => {
    if (selectionData[key]) {
    let selectedId = key.split("row-")[1];
    if ("NaN" !== String(Number(selectedId))) return selectedId;
        }
}).filter(x => !!x)

Also, sorting doesn't seem to work either