# spectramicro-table

> ```jsx import DataTable from "spectramicro-table";

Latest version **2.1.9** (published 2022-06-02) · ISC license · 0 weekly downloads

## Install

```sh
npm install spectramicro-table
pnpm add spectramicro-table
yarn add spectramicro-table
bun add spectramicro-table
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.9 |
| Published | 2022-06-02 |
| First published | 2020-08-28 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 5 MB |
| Known vulnerabilities | 0 (+12 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | datapractice |

## Links

- npm: https://www.npmjs.com/package/spectramicro-table
- npm.io page: https://npm.io/package/spectramicro-table

## Dependencies (3)

- [jspdf](https://npm.io/package/jspdf.md) ^2.3.1
- [jspdf-react](https://npm.io/package/jspdf-react.md) ^1.0.11
- [jspdf-autotable](https://npm.io/package/jspdf-autotable.md) ^3.5.14

## Recent versions

- 2.1.9 (latest) — 2022-06-02
- 2.1.8 — 2022-05-20
- 2.1.5 — 2022-05-20
- 2.1.4 — 2022-05-19
- 2.1.3 — 2022-05-19
- 2.1.1 — 2022-05-19
- 2.0.2 — 2021-06-10
- 2.0.1 — 2021-06-10
- 2.0.0 — 2021-05-31
- 1.2.9 — 2021-05-27
- 1.2.8 — 2021-05-27
- 1.2.7 — 2021-05-27
- 1.2.6 — 2021-05-26
- 1.2.5 — 2021-05-26
- 1.2.4 — 2021-05-26
- … 14 more at https://npm.io/package/spectramicro-table/versions

## README

A Table component using ant-design

## Usage

```jsx
import DataTable from "spectramicro-table";

const dataTableConfig = {
  apiUrl: "", // Base URL for resultset api
  enableSort: true,
  enableClientSideSort: false,
  enableColumnSearch: true,
  defaultColumnWidth: "33%",
  defaultSortOrder: "descend",
  enableBorder: true,
  enableSearchBar: true,
  searchBarPlaceholder: "",
  size: "large",
  enableTitleBar: true,
  title: "",
  enableFooterBar: false,
  footer: "",
  searchBarStyle: {
    float: "right",
    marginBottom: "5px",
  },
  columnStyle: {
    ...
    app_id: {
      width: "33%",
    },
    ...
  },
  pagination: {
    pageSize: 10,
    current: 1,
    total: 100,
  },
  fixedHeader: {
    y: 420,
    scrollToFirstRowOnChange: false,
  },
  tableOptions: { // show table options
    allowToggleColumnVisibility: true // Enable Show/Hide Columns
  },
  allowToggleColumnVisibility: true // Show/Hide button only
};


const initialRequest = {
  appId: "APP_id",
  resultsetId: "RESULTSET_ID",
  metadata: true,
  pageSize: 10,
  filters: [],
};

// SAMPLE COLUMN CONFIG
const columns = [
    {
      displayName: "text",
      fieldName: "key",
      fixed: "true",
      onCell: "event",
      render: "event",
      sortOrder: "1"
    }
];

// RESULTSET API RESPONSE (Not required if initialRequest is set)
const data = {
  // config: columns
};

const onRowClick = (row, rowIndex, event) => {};
const onCellClick = (row, rowIndex, event) => {};
const handleTableChange = (
  tableData
) => {};

const onRequest = () => {};
const onRequestSuccess = () => {};
const onRequestFailure = (err) => {};

<DataTable
  loading={false}
  initialRequest={initialRequest}
  config={dataTableConfig}
  data={response}
  onRowClick={onRowClick}
  onCellClick={onCellClick}
  onTableChange={handleTableChange}
  onRequest={onRequest}
  onRequestSuccess={onRequestSuccess}
  onRequestFailure={onRequestFailure}
/>;
```

---
_Source: https://npm.io/package/spectramicro-table · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
