react-bootstrap-table2
react-bootstrap-table2 copied to clipboard
Select Row remains selected/checked even after external action/function applied
I have a selectRow which is as following.
let ids = [];
const selectRow = {
mode: "checkbox",
clickToSelect: false,
onSelect: (row, isSelect) => {
if (isSelect && !ids.includes(row.id)) {
ids.push(row.id);
} else {
ids.splice(
ids.findIndex((e) => e === row.id),
1
);
}
},
onSelectAll: (isSelect, rows) => {
isSelect ? (ids = rows.map((a) => a.id)) : (ids = []);
},
selected: false,
};
const bulkUpdate = (ids, status) => {
if (ids.length === 0 || ids === undefined) {
errorAlert(intl.formatMessage({ id: "ERROR" }), intl.formatMessage({ id: "ERROR.MESSAGE" }), intl.formatMessage({ id: "GLOBAL.YES" }), "error");
} else {
const obj = {
ids,
status,
};
dispatch(bulkUpdateEmail(obj));
}
};
Even after the function bulkUpdate is performed the row remains selected in the design but throws (custom) error of row is not selected.
Any update from this issue? I have more or less the same error 😅