Get global row index that is fixed regardless of filtering, pagination or sorting
I am using "react-bootstrap-table2" package, and what I am trying to do is to copy the data from the table to other components using some global context.
Right now rowIndex acts as an index of the rows in the current page, so rowIndex=1 refers to different set of data (row) if I sort or filter or move to next page..etc.
Is there any row related argument (similar to rowIndex) that I can use as a data id for the row? This id does not change in case of filtering, pagination or whatever, it just acts like a global id. How can I get such behavior?
This is how selectRow looks like in my code. And what I am trying to do is to send the rowIndex to the global context (updatGloabalContext) so it will distribute it to other components, but the global context does not know about any table-related operations (sort, search, filter, pagination...)
selectRow = {
mode: 'radio',
clickToSelect: true,
hideSelectColumn: true,
bgColor: this.context.operationType === "red",
onSelect: (row, isSelect, rowIndex, e) => {
this.updatGloabalContext(rowIndex);
}
};
I ran into a similar situation. But I maintain a list of all the rows, so I can find the global index by allRows.indexOf(row).