Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

85
Views
How to make checkboxes appear conditionally in MUI Datatable

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().

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!