1.0.1 • Published 1 year ago

material-ui-grouped-table v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

NPM Edit on Codesandbox

Installation

npm

npm i material-ui-grouped-table --save

yarn

yarn add material-ui-grouped-table

Usage

import React from 'react';
import GroupedColumnTableComponent from "material-ui-grouped-table";

export default function App() {
  return (
    <div className="App">
      <GroupedColumnTableComponent rows={[]} columns={[]} />
    </div>
  );
}

Example Component

Data

The Data interface represents an object with dynamic keys and values, with the values being of any type. It has the following structure:

NameTypeDescription
keystringAn object with dynamic keys and values.

Note that the key in the interface definition represents any string key name that you might use to define properties in the object.

GroupedColumn

The following properties can be passed to the GroupedColumn object:

NameTypeDefaultDescription
labelstringThe display name for the column.
idstringundefinedA unique identifier for the column.
minWidthnumberundefinedThe minimum width for the column.
align'right' | 'left' | 'center''left'The alignment of the column content.
format(value: any) => React.ReactNodeundefinedA function that formats the content of the column.
color(value: any) => stringundefinedA function that returns the color of the column content.
onClick(value: any) => voidundefinedA callback function triggered when a column is clicked. It passes the value of the clicked column as an argument.
navigateTo(value: any) => stringundefinedA function that returns the URL to navigate to when a column is clicked.
widthstring | numberundefinedThe width of the column.
childrenGroupedColumn[]undefinedAn array of GroupedColumn objects representing child columns.
columnSxPropsSxPropsundefinedSx Props for customizing the column.

GroupedTableProps

The following props can be passed to the GroupedTable component:

NameTypeDefaultDescription
rowsData[]nullData for Table
columnsGroupedColumn[]nullThe Columns for the Table
onClick(value: Data) => voidundefinedCallback function triggered when a row is clicked. It passes the value of the clicked row as an argument.
enableSortbooleanundefinedBoolean indicating whether the table should be sortable.
enableBordersbooleanundefinedBoolean indicating whether the table should have borders.
ellipsisbooleanundefinedBoolean indicating whether text in the table should be truncated with an ellipsis.
fixedHeightnumberundefinedNumber representing the height of the table.
enableFiltersbooleanundefinedBoolean indicating whether the table should display filtering options.
filterChanges(value: IGenericObject) => voidundefinedCallback function triggered when a filter is changed. It passes an object containing the current filter values as an argument.
enableCheckBoxbooleanundefinedBoolean indicating whether the table should display checkboxes.
checkBoxChange(data: readonly string[]) => voidundefinedCallback function triggered when a checkbox is changed. It passes an array of the checked rows as an argument.
checkboxSelectorstringundefinedString representing the column to display checkboxes in.

Built With

  • React - A JavaScript library for building user interfaces

License

MIT Licensed. Copyright (c) Vishal Ramanand Sharma 2023.

1.0.1

1 year ago

1.0.0

1 year ago