New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

dp-data-table

Package Overview
Dependencies
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dp-data-table

A simple and easy to customize data table with filter and sort functionalities. This component is build using React and can be directly used in static html as well.

latest
Source
npmnpm
Version
3.0.0
Version published
Maintainers
0
Created
Source

dp-data-table

dp Data Table is a simple ready to integrate component made in React using bootstrap styling.

Screenshot

dp Data Table

Integration

Here is a sample integration:

<script src="https://cdnjs.cloudflare.com/ajax/libs/react/18.2.0/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/18.2.0/umd/react-dom.production.min.js"></script>
<script src="dist/dpDataTable.js"></script>
<script>
  window.RenderDpDataTable({
    selector: '#data-table-1',
    items: [.......]
  });
</script>

React Integration:

import React from 'react';
import DpDataTable from 'dp-data-table';

......

<DataTable items={[.......]} />

To have proper styling, include bootstrap.

Options

The options are passed in as props when used as a React component.

OptionTypeDescription
itemsarrayCollection of items to bind to the grid
headersarrayarray of keys and their matching Header names.[{'first_name' : 'First Name'}]
hidePaginationbooleanBoolean to hide the pagination values. Setting this to true will show all items in same page.
itemsPerPagenumberNo of items per page. Default is 15.
isLoadingbooleanBoolean to show the loading icon over the grid.
iconClassesobjectAn object with all the class names for the font icons used in the project. {LOADING: 'glyphicon glyphicon-refresh'}. Available options to override: LOADING, EDIT, DELETE, PAGE_PREV, PAGE_NEXT, FILTER, SORT_NONE, SORT_ASC, SORT_DESC
showFilterbooleanBoolean to show the filter input
filterableFieldsarrayArray of item property keys that can be made filterable. If not provided, all columns are filterable.
onFilteringfunctionOverride function for filter. onFiltering({items, filterString})
showSortbooleanBoolean to show column sort
sortableFieldsarrayArray of column keys which can be sorted.
showContextColorbooleanBoolean to add context css to table row. Setting this to true will apply the __dp__contextCss property of item, to the row.
onSortingfunctionOverride function to sortonDeleting({items, sortKey, sortOrder})
onEditingfunctionEvent handler for editing a row. The edit icon is enabled only when a function is supplied to this option.onEditing({item, index})
onDeletingfunctionEvent handler for deleting a row. The delete icon is enabled only when a function is supplied to this option.onDeleting({item, index})
onViewfunctionEvent handler for viewing details of a row. The view icon is enabled only when a function is supplied to this option.onView({item, index})
onItemsChangefunctionEvent handler to get all changes that happen within the component. onItemChange(e)

Development

  • Development server npm start.
  • Continuously run tests on file changes npm run watch-test;
  • Run tests: npm test;
  • Build npm run build;

Keywords

react-component

FAQs

Package last updated on 16 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts