I want to apply the specific options to all tables in application.
How I do?
For example:
All Material Tables hav such options
options={{
showTitle: false,
padding: 'dense',
pageSize: 10,
pageSizeOptions: [10, 20, 50],
headerStyle: {
backgroundColor: 'transparent',
fontWeight: 'bold',
}
}}
Hi @watanabeshuji,
to have a default options in all tables you can import a var configuration and use the property spread notation (It was added in ES2018).
Your table configuration
export const TableDefaultConfig = {
options: {
showTitle: false,
padding: 'dense',
pageSize: 10,
pageSizeOptions: [10, 20, 50],
headerStyle: {
backgroundColor: 'transparent',
fontWeight: 'bold',
}
}
}
Your page with table
import { TableDefaultConfig } from '../TableConfig';
<MaterialTable
options={{
...TableDefaultConfig.options,
pageSize: 20,
}}
/>
thank a lot!