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

185
Visualizações
rsuite table render dynamic column and row

I would like to render table columns and rows in rsuite table dynamically according to the data passed without hardcoding the column and data.

import { Table, Column, HeaderCell, Cell, RowDataType } from 'rsuite-table'; import 'rsuite-table/dist/css/rsuite-table.css'

import React from 'react'

export default function App() {

// Sample table data
const sampleData : any[] = [
    { firstName: 'Gourav', lastName: 'Hammad', city: 'Mhow' },
    { firstName: 'Rithik', lastName: 'Verma', city: 'Indore' },
    { firstName: 'Kartik', lastName: 'Malik', city: 'Raipur' },
    { firstName: 'Nikhil', lastName: 'Kapoor', city: 'Rau' },
    { firstName: 'Ayush', lastName: 'Singh', city: 'Dewas' }
]

return (
    <div style={{
        display: 'block', width: 700, paddingLeft: 30
    }}>
        <h4>React Suite Table Component</h4>
 
        <Table
            height={500}
            data={sampleData}
        >    
    here I want to generate the column and row based on given data 
        </Table>
    </div>
);

}

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

const sampleData = [{}, {}, {}] // some array of objects
const keys = Object.keys(sampleData[0]);

return (
    <div style={{
        display: 'block', width: 700, paddingLeft: 30
    }}>
        <h4>React Suite Table Component</h4>
 
        <Table
            height={500}
            data={sampleData}
        >    
     /// here I want to generate the column and row based on given data 
          {
            keys.map(data_key => (
               <Column>
                   <HeaderCell>{data_key}</HeaderCell>
                   <Cell dataKey={data_key} />
               </Column>
            ))
          }
        </Table>
    </div>
);

dont forget take care off key because using map

about 4 years ago · Juan Pablo Isaza Relatório
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