Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

91
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda