react-bootstrap-table2 icon indicating copy to clipboard operation
react-bootstrap-table2 copied to clipboard

Select Row remains selected/checked even after external action/function applied

Open dextel2 opened this issue 4 years ago • 1 comments

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.

dextel2 avatar Sep 15 '21 12:09 dextel2

Any update from this issue? I have more or less the same error 😅

201flaviosilva avatar Jun 03 '22 10:06 201flaviosilva