Material-table: How to add style to ToolBar

Created on 23 Jan 2019  路  9Comments  路  Source: mbrn/material-table

Hi,

I tried with below to add style to Toolbar as mentioned in Docs. When I click on link to display table, webpage is not responding. It got hung. No errors in console as well. Any issue with this code ? Or any way to add style to Toolbar?

import MTableToolbar from 'material-table'

components={{
Toolbar: props => (



),
}}

Thanks,
Kalesha sheik

help wanted

Most helpful comment

Use

import MaterialTable, {MTableToolbar} from 'material-table'

instead of

import MaterialTable from 'material-table'
import MTableToolbar from 'material-table'

All 9 comments

Hi @kaleshasheik,

Example on material-table docs is working. Can you share your material-table usage?

Hi @kaleshasheik,

Example on material-table docs is working. Can you share your material-table usage?

Hi,

Even i tried with example mentioned in Docs. Same issue

import MaterialTable from 'material-table'
import MTableToolbar from 'material-table'

components={{
Toolbar: props => (



),
}}
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 },
{ name: 'Mehmet', surname: 'Baran', birthYear: 1987, birthCity: 63 },
{ name: 'Mehmet', surname: 'Baran', birthYear: 1987, birthCity: 63 },
]}
title="Customizing Toolbar"
options={{
columnsButton: true,
filtering: true,
}}
/>

Use

import MaterialTable, {MTableToolbar} from 'material-table'

instead of

import MaterialTable from 'material-table'
import MTableToolbar from 'material-table'

Use

import MaterialTable, {MTableToolbar} from 'material-table'

instead of

import MaterialTable from 'material-table'
import MTableToolbar from 'material-table'

I am getting below error if i use , import MaterialTable, {MTableToolbar} from 'material-table'

TS2305: Module '"D:/React/inventory/node_modules/material-table/index"' has no exported member 'MTableToolbar'.
Version: typescript 3.1.6, tslint 5.11.0

Which version of material-table do you use?

"material-table": "^1.13.0",

I am not sure why it is not working. I will try it with Typescript.

I am not sure why it is not working. I will try it with Typescript.

Ok. Thanks

Hi @kaleshasheik , sorry for late response but i was very busy.

I found the problem with this. There is no export for definitions components on index.ts.

As a workaround you can do this:

// @ts-ignore
import MaterialTable, {MTableToolbar} from 'material-table'

I will open another issue to append all components' ts definition

Was this page helpful?
0 / 5 - 0 ratings