Material dataTable

Asked
Active3 hr before
Viewed126 times

9 Answers

datatablematerial
90%

Material-Datatable is a data tables component built on Material-UI V1. It comes with features like filtering, resizable + view/hide columns, search, export to CSV download, printing, selectable rows, pagination, and sorting. On top of the ability to customize styling on most views, there are two responsive modes "stacked" and "scroll" for mobile/tablet devices.,Renamed MuiDatatablesTableState to MaterialDatatableState in TS definition,If you are looking to work with remote data sets or handle pagination, filtering, and sorting on a remote server you can do that with the following options:

import MaterialDatatable from "material-datatable";

const columns = [
    {   
        name: 'Name', 
        field: 'name',
        options: {
            width: 70,
        },
    },
    {
        name: 'Title', 
        field: 'title'
    },
    {
        name: 'Location', 
        field: 'location',
        options: {
            width: 100,
        },
    },
    {
        name: 'Age', 
        field: 'age'
    },
    {
        name: 'Salary', 
        field: 'salary'
    },
    {
        name: 'Veeeeery loooooooooong naaaaaaaaaaame title', 
        field: 'salary',
        options: {
            headerNoWrap: true,
            customBodyRender: (value, tableMeta, updateValue) => {
                return `${value.name} (${value.title})`; 
            }
        },
    }
];
 const data = [
    {name: "Veeeeery loooooooooong naaaaaaaaaaame", title: "Title 1", location: "Location 1", age: 30, salary: 10},
    {name: "Name 2", title: "Title 2", location: "Location 2", age: 31, salary: 11},
];

const options = {
    filterType: 'checkbox',
};

<MaterialDatatable
    title={"Employee List"}
    data={data}
    columns={columns}
    options={options}
/>
load more v
88%

Pretag
 Pretag team - issue, fix, solve, resolve
72%

npm i material-datatable,npm install material-datatable --save,github.com/diaver/material-datatable#readme

 import MaterialDatatable from "material-datatable"const columns = [    {           name'Name',         field'name',        options: {            width70,        },    },    {        name'Title',         field'title'    },    {        name'Location',         field'location',        options: {            width100,        },    },    {        name'Age',         field'age'    },    {        name'Salary',         field'salary'    },    {        name'Veeeeery loooooooooong naaaaaaaaaaame title',         field'salary',        options: {            headerNoWraptrue,            customBodyRender(value, tableMeta, updateValue) => {                return `${value.name} (${value.title})`;             }        },    }]; const data = [    {name"Veeeeery loooooooooong naaaaaaaaaaame"title"Title 1"location"Location 1"age30salary10},    {name"Name 2"title"Title 2"location"Location 2"age31salary11},]; const options = {    filterType'checkbox',}; <MaterialDatatable    title={"Employee List"}    data={data}    columns={columns}    options={options}/> 
load more v
65%

Pretag
 Pretag team - issue, fix, solve, resolve
75%

This example shows DataTables styled for Google's Material Design. The Material Design Lite libraries are used to provide the styling implementation for Material.,The following CSS library files are loaded for use in this example to provide the styling of the table:,In addition to the above code, the following Javascript library files are loaded for use in this example:

Pretag
 Pretag team - issue, fix, solve, resolve
40%

a complete example of how to implement an Angular Material Data Table with server-side pagination, sorting and filtering using a custom CDK Data Source,And with this in place, we have completed our example! We now have a complete solution for how to implement an Angular Material Data Table with server-side pagination, sorting and filtering.,We are going to cover many of the most common use cases that revolve around the Angular Material Data Table component, such as: server-side pagination, sorting, and filtering.

Pretag
 Pretag team - issue, fix, solve, resolve
22%

Pretag
 Pretag team - issue, fix, solve, resolve
60%

The Table component has a close mapping to the native <table> elements. This constraint makes building rich data tables challenging.,The ActionsComponent prop of the TablePagination component allows the implementation of custom actions.,An example of a table with expandable rows, revealing more information. It utilizes the Collapse component.

<DataGrid
  rows={rows}
  columns={columns}
  pageSize={5}
  checkboxSelection
  disableSelectionOnClick
/>
load more v
48%

DataColumn, which describes a column in the data table.,DataRow, which contains the data for a row in the data table.,DataCell, which contains the data for a single cell in the data table.

Widget build(BuildContext context) {
  return DataTable(
    columns: const <DataColumn>[
      DataColumn(
        label: Text(
          'Name',
          style: TextStyle(fontStyle: FontStyle.italic),
        ),
      ),
      DataColumn(
        label: Text(
          'Age',
          style: TextStyle(fontStyle: FontStyle.italic),
        ),
      ),
      DataColumn(
        label: Text(
          'Role',
          style: TextStyle(fontStyle: FontStyle.italic),
        ),
      ),
    ],
    rows: const <DataRow>[
      DataRow(
        cells: <DataCell>[
          DataCell(Text('Sarah')),
          DataCell(Text('19')),
          DataCell(Text('Student')),
        ],
      ),
      DataRow(
        cells: <DataCell>[
          DataCell(Text('Janine')),
          DataCell(Text('43')),
          DataCell(Text('Professor')),
        ],
      ),
      DataRow(
        cells: <DataCell>[
          DataCell(Text('William')),
          DataCell(Text('27')),
          DataCell(Text('Associate Professor')),
        ],
      ),
    ],
  );
}
load more v

Other "datatable-material" queries related to "Material dataTable"