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

186
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
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