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

91
Views
¿Hay alguna manera de agregar un <label></label> a cada encabezado de columna usando Material Table React?

Hola, estoy tratando de agregar un <label></label> a cada celda de la tabla. Estoy usando la tabla de materiales aquí:https://material-table.com/#/docs/features/component-overriding

Intenté así:

 <Table onChangePage={handleChangePage} page={props.currentPage} totalCount={props.totalCount} options={{ paging:true, pageSizeOptions:[10, 15, 25, 50], pageSize: props.rowsPerPage, padding: "dense", search: false, toolbar:false, headerStyle: TableHeaderRow, <--- cssproperties rowStyle:TableRow <--- cssproperties }} columns={columns} <--- variable columns:TableColumn[] data={dataAct} <---- data generated from API />

En realidad, headerStyle el estilo de encabezado en las opciones, pero lo que realmente quiero es agregar un

 <label> headerValueHere} </label>

para cada encabezado.

Agregué una etiqueta de etiqueta a las celdas como usar render en la definición de columnas:

 const getDocumentTypeForRow = rowData => { return ( <Tooltip title={rowData}> <label style={OpenVulnerabilityDuePatchingCardDetailsElementLabel}> {rowData} </label> </Tooltip> ) }; const columns: TableColumn<>[] = [ { title: 'Due Date', field: 'remediation_due_date', render: data => getDocumentTypeForRow(data.remediation_due_date) }, ]

Pero, ¿cómo hacer esto para los encabezados?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede pasar JSX o HTML al título

 const columns: TableColumn<>[] = [ { title: <label>Due Date</label>, field: 'remediation_due_date', render: data => getDocumentTypeForRow(data.remediation_due_date) }, ]

Puede editar en vivo aquí y ver los resultados.

https://material-table.com/#/docs/features/styling

 columns={[ { title: <h1>Heading 1</h1>, field: 'name', cellStyle: { backgroundColor: '#039be5', color: '#FFF' }, headerStyle: { backgroundColor: '#039be5', } }, { title: 'Surname', field: 'surname' }, { title: 'Birth Year', field: 'birthYear', type: 'numeric' }, { title: 'Birth Place', field: 'birthCity', lookup: { 34: 'İstanbul', 63: 'Şanlıurfa' }, }, ]}
about 4 years ago · Juan Pablo Isaza Report
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!