Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to setup material-table in react

import * as React from 'react';
import MaterialTable from 'material-table';
import { ThemeProvider, createTheme } from '@mui/material';

export class DataGridReact extends React.Component {
    public render(): JSX.Element {
        const defaultMaterialTheme = createTheme();

        return(
            <div style={{ width: '100%', height: '100%' }}>
                <link
                    rel="stylesheet"
                    href="https://fonts.googleapis.com/icon?family=Material+Icons"
                    />
                <ThemeProvider theme={defaultMaterialTheme}>
                    <MaterialTable
                        columns={[
                        { title: 'Name', field: 'name' },
                        { title: 'Surname', field: 'surname' },
                        { title: 'Birth Year', field: 'birthYear', type: 'numeric' },
                        { title: 'Birth City', field: 'birthCity', lookup: { 1: 'Linz', 2: 'Vöcklabruck', 3: 'Salzburg' } }
                        ]}
                        data={[
                            { name: 'Max', surname: 'Mustermann', birthYear: 1987, birthCity: 1 },
                            { name: 'Cindy', surname: 'Musterfrau', birthYear: 1995, birthCity: 2 }
                        ]}
                        title="Personen"
                    />
                </ThemeProvider>
            </div>
        );
    }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: js hide element 
Javascript :: react convert table to pdf 
Javascript :: angular size of array 
Javascript :: generate string from regex javascript 
Javascript :: javascript target closest id 
Javascript :: javascript test if undefined 
Javascript :: https request node.js output incomplete 
Javascript :: how to assert input value in testing library 
Javascript :: jvectormap color regions 
Javascript :: div diseaper going down 
Javascript :: does kendo window content clear on close 
Javascript :: Apollo graphql fragment 
Javascript :: js contains 
Javascript :: CodePen Home Load iframe on click 
Javascript :: launch json for golang with args 
Javascript :: .env file example react native 
Javascript :: how to give data from react native to webview 
Javascript :: sitecore rendering paramaters get 
Javascript :: how to generate random gradient javascript 
Javascript :: jsx map with index 
Javascript :: json regex 
Javascript :: ionic vue use .env 
Javascript :: javascript find area of triangle 
Javascript :: how to fetch data from json file in flutter 
Javascript :: Fetch Data Using Getx 
Javascript :: create slug using middleware 
Javascript :: decapitalize javascript string 
Javascript :: hook usePreloadImages 
Javascript :: Delete a user in ExpressJS 
Javascript :: node express tutorial 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =