I have a MUI Datatable. While defining 'options' for the table, I am setting selectableRows: 'multiple', selectableRowsHeader: true,
This creates a table with the checkboxes for all rows and also the selectall checkbox on top. However, I want it to appear only when I click a certain button in the title. How do i do this?
My code snippet is as follows
columns={columns}
options={{
...muiDataTableCommonOptions(),
download: false,
expandableRowsOnClick: false,
search: false,
page: currentPage,
rowsPerPage: numberOfRows,
count: serialsTotalCounts,
selectableRows: 'multiple',
selectableRowsHeader: true,
onRowClick: (rowData, rowMeta) => console.log('onRowsSelect.', rowData, rowMeta),
customToolbar: () => (
<SerialsCustomToolbar
showAddSerialButton={false}
textSearched={(text) => {
//DISORIENTED_SERIALS_LISTING - optional callback to handle rendering while using search box
this.query['searchText'] = text;
this.setState({ initialized: false }, () => {
this.pages.limit = LIMIT_PAGINATION_MAX;
this.pages.offset = 0;
const query = Object.assign({}, this.query, this.pages);
this.updateQuery(query);
});
}}
This is is just the code relevant to the table options. How do i conditionally define those props for the table options element? I cant use if-else as this is jsx and inside the render().