1.1.10 • Published 2 years ago

material-table-next v1.1.10

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

material-table-next

Travis npm package Coveralls

A simple material-ui data table

import React, { Component } from "react";
import { Chip } from "@mui/material";
import { render } from "react-dom";
import MaterialTableNext from "material-table-next";

const rows = [
  {
    id: "1",
    name: "Cupcake",
    calories: 805,
    fat: 3.7,
    carbs: 77,
    protein: 1.3,
  },
  {
    id: "2",
    name: "Donut",
    calories: 305,
    fat: 4.7,
    carbs: 97,
    protein: 6.3,
  },
  {
    id: "3",
    name: "Frozen yoghurt",
    calories: 705,
    fat: 2.7,
    carbs: 17,
    protein: 6.3,
  },
  {
    id: "4",
    name: "Gingerbread",
    calories: 605,
    fat: 2.7,
    carbs: 87,
    protein: 7.3,
  },
  {
    id: "5",
    name: "Honeycomb",
    calories: 105,
    fat: 2.7,
    carbs: 47,
    protein: 8.3,
  },
  {
    id: "6",
    name: "Ice cream sandwich",
    calories: 405,
    fat: 2.7,
    carbs: 67,
    protein: 6.3,
  },
];

const headCells = [
  {
    id: "name",
    numeric: false,
    disablePadding: true,
    label: "Dessert (100g serving)",
  },
  {
    id: "calories",
    numeric: true,
    disablePadding: false,
    label: "Calories",
    onRender: (data) => {
      return <Chip label={data?.calories} />;
    },
  },
  {
    id: "fat",
    numeric: true,
    disablePadding: false,
    label: "Fat (g)",
  },
  {
    id: "carbs",
    numeric: true,
    disablePadding: false,
    label: "Carbs (g)",
  },
  {
    id: "protein",
    numeric: true,
    disablePadding: false,
    label: "Protein (g)",
  },
];

export default class Demo extends Component {
  render() {
    return (
      <div>
        <h1>material-table-next Demo</h1>
        <MaterialTableNext
          title={"Test Table"}
          searchKeys={["name"]}
          rows={rows}
          headCells={headCells}
          // loading={true}
          onDelete={(data) => {
            console.log("data", data);
          }}
          onEdit={(data) => {
            console.log(data);
          }}
        />
      </div>
    );
  }
}

render(<Demo />, document.querySelector("#demo"));
1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.10

2 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago