1.1.2 • Published 2 years ago

spectramicro-search v1.1.2

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

A Table component using ant-design

Usage

import DataTable from "spectramicro-table";

const dataTableConfig = {
  apiUrl: "",
  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%",
    },
    ...
  },
  searchableColumns: ["app_id"],
  pagination: {
    pageSize: 10,
    current: 1,
    total: 100,
  },
  fixedHeader: {
    y: 420,
    scrollToFirstRowOnChange: false,
  },
};


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}
/>;
1.1.2

2 years ago

1.1.0

4 years ago

1.0.0

4 years ago