material-table icon indicating copy to clipboard operation
material-table copied to clipboard

Is it possible to get rid of column headers

Open urirahimi opened this issue 7 years ago • 3 comments

Is it possible to get rid of the column headers? screen shot 2018-12-31 at 7 53 34 am

urirahimi avatar Dec 31 '18 15:12 urirahimi

I can add this feature for next release.

But i can give a workaround:

  1. set paging and toolbar to false in options
  2. override Header components with null
<MaterialTable
          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={this.state.data}
          title="Demo Title"
          components={{
            Header: props => null
          }}
          options={{
            toolbar: false,
            paging: false
          }}
        />

mbrn avatar Dec 31 '18 16:12 mbrn

Just curious, why is it that there are two sets of curly braces on options. I.e. why do you have to type options: {{ paging: false }} instead of just options: { paging: false }

jakeleventhal avatar Jan 17 '19 18:01 jakeleventhal

Because first brace for react props. Second one means options is a json object. So you cant give many props with one brace. It is same with style props of component:

<div style={{color: 'red'}}>red text</div>

mbrn avatar Jan 17 '19 18:01 mbrn