Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

86
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda