Material-table: Unexpected behavior with header styling

Created on 15 Mar 2019  路  4Comments  路  Source: mbrn/material-table

Describe the bug
https://mbrn.github.io/material-table/#/docz-examples-10-example-component-overriding
When trying to apply this to the table header, the cell columns get unaligned

Screenshots
Here is my code with a screenshot:

components={{
                    Header: props => (
                      <div style={{ background: palette.primary.main }}>
                        <MTableHeader {...props} />
                      </div>
                    )
                  }}

Screen Shot 2019-03-15 at 11 54 48 AM

help wanted

All 4 comments

Hi @jakeleventhal ,

You can not cover MTableHeader with a div.

Can you try this instead of it:

<MaterialTable
  options={{
    headerStyle: { background: 'red' }
  }}
  columns={[
    { title: 'Ad谋', field: 'name' },
    { title: 'Soyad谋', field: 'surname' },
    { title: 'Do臒um Y谋l谋', field: 'birthYear', type: 'numeric' },
    {
      title: 'Do臒um Yeri',
      field: 'birthCity',
      lookup: { 34: '陌stanbul', 63: '艦anl谋urfa' },
    },
  ]}
  data={[
    { name: 'Mehmet', surname: 'Baran', birthYear: 1987, birthCity: 63 },
  ]}
  title="Demo Title"
/>

That works, the docs made it a little hard to infer that this was the correct solution though.

Thanks!

This change breaks when upgrading from 1.24->1.25+

Hi @jakeleventhal ,

It is fixed with 1.28.1.

Was this page helpful?
0 / 5 - 0 ratings