reactjscustomizationmui-datatable

Custom enable/disable select rows mui-datatables


I have a Mui-DataTable and I need to personalize the rows selection. In the documentation, I found the "isRowSelectable" function. But this method returns me only two parameters: dataIndex and selectedRows. In my table, I have a column called status, with two states: active and inactive. When the row status is inactive, I need to disable the row selection. Unfortunately, the "isRowSelectable" API doesn't return my data to compare the status and, so, enable or disable my row selection.

Does anyone have any idea of how can I do it?


Solution

  • I found a "solution". It's working, but it's not a beautiful way to solve the problem. Nevertheless, here is my approach:

    return dataIndex < totalRows-countStatus ? true : false
    

    As I stated before, it isn't beautiful, but it's working well.