All Projects → cheekujha → react-table-filter

cheekujha / react-table-filter

Licence: MIT license
Create Filters on table column items(like Excel)

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects
SCSS
7915 projects

Projects that are alternatives of or similar to react-table-filter

react-dates
An easily internationalizable, mobile-friendly datepicker library for the web
Stars: ✭ 12,032 (+22181.48%)
Mutual labels:  react-component
react-scale-text
A React library to keep an element's text scaled to fit it's container
Stars: ✭ 39 (-27.78%)
Mutual labels:  react-component
react-infinite-scroller
⏬ Infinite scroll component for React in ES6
Stars: ✭ 3,064 (+5574.07%)
Mutual labels:  react-component
git-issue-react-electronjs
⚙️. ⚛️. A desktop application created with Electronjs and Reactjs to be cross-platform to manage and track GitHub issues.
Stars: ✭ 21 (-61.11%)
Mutual labels:  react-component
react-file-input
⚛️  A file Input, with drag'n'drop and image editor for React
Stars: ✭ 71 (+31.48%)
Mutual labels:  react-component
react-mathjax-preview
The MathJax React component you were looking for.
Stars: ✭ 46 (-14.81%)
Mutual labels:  react-component
react-timer-wrapper
Composable React Timer component that passes status props to children, in addition to some basic callbacks. Can be used at a countdown timer ⏲ or as stopwatch ⏱ to track time while active.
Stars: ✭ 14 (-74.07%)
Mutual labels:  react-component
FaceFilter
Snapchat and Instagram like Face Filter.
Stars: ✭ 72 (+33.33%)
Mutual labels:  filters
react-native-slider-intro
A simple and fully customizable React Native component that implements an intro slider for your app
Stars: ✭ 80 (+48.15%)
Mutual labels:  react-component
react-simple-image-slider
simple image slider component for react
Stars: ✭ 127 (+135.19%)
Mutual labels:  react-component
react-textarea-code-editor
A simple code editor with syntax highlighting.
Stars: ✭ 247 (+357.41%)
Mutual labels:  react-component
react-ignore-rerender
🚀 Simple component for ignoring the re-rendering of a piece of React's render method.
Stars: ✭ 28 (-48.15%)
Mutual labels:  react-component
tiny-ui
⚛️ A friendly UI component set for React.js
Stars: ✭ 202 (+274.07%)
Mutual labels:  react-component
react-ratings-declarative
A customizable rating component for selecting x widgets or visualizing x widgets
Stars: ✭ 41 (-24.07%)
Mutual labels:  react-component
fhir-questionnaire-render-react
Render FHIR Questionnaire as a web form using FHIRFormJS
Stars: ✭ 18 (-66.67%)
Mutual labels:  react-component
vesdk-android-demo
VideoEditor SDK: A fully customizable video editor for your app.
Stars: ✭ 90 (+66.67%)
Mutual labels:  filters
react-multiselect-two-sides
React multiselect two sides component
Stars: ✭ 15 (-72.22%)
Mutual labels:  react-component
react-parallax-card
[wip] React component for a 3D card with parallax effects similar to Apple TV app icons.
Stars: ✭ 21 (-61.11%)
Mutual labels:  react-component
esn
这是一个常用js小型工具库
Stars: ✭ 15 (-72.22%)
Mutual labels:  react-component
VOSviewer-Online
VOSviewer Online is a tool for network visualization. It is a web-based version of VOSviewer, a popular tool for constructing and visualizing bibliometric networks.
Stars: ✭ 44 (-18.52%)
Mutual labels:  react-component

react-table-filter

Module creates Excel like Column Filters for Table. The filter list contains all the unique items present in every column. See image below for example.

alt text

Demo

https://cheekujha.github.io/react-table-filter/

Install

You need to have react and react-dom as dependencies in your project.

  1. With npm installed, run
$ npm install react-table-filter --save
  1. At this point you can import react-table-filter and its styles in your application as follows:
import TableFilter from 'react-table-filter';

// Be sure to include styles at some point, probably during your bootstraping
// In JS
import react-table-filter/lib/styles.css;

// In SCSS
@import "path-to-node_modules/react-table-filter/lib/styles.css";

// Or directly import css
<link href="path-to-react-table-filter/lib/styles.css" rel="stylesheet" />

Usage

  1. Wrap header columns (th / td) with TableFilter as shown below.
<TableFilter
  rows={data}
  onFilterUpdate={this._filterUpdated}>
  <th filterkey="name">
    Name
  </th>
  <th filterkey="season">
    Season
  </th>
  <th filterkey="number">
    Number
  </th>
</TableFilter>

Required Props on TableFilter

rows - Initial Array of Items

onFilterUpdate - Function called with updated filtered data when filters are added/removed. This function is used to show updated data by your application. Ex:

filterUpdated = (newData, filterConfiguration) => {
		this.setState({
			"upddatedData": newData
		});
	}
Arguments Detail:
newData - Filtered Data to be used to show on UI
filterConfiguration - Current filters configuration.

filterConfiguration can be saved and be passed as prop(initialFilters) to TableFilter to maintain filter state while initializing the component.(In case user navigates away and comes back etc.)

Required Props on th/td (Header columns)

filterkey - The key by which that column is to be filtered(key as present in rows data)

Only the Columns with "filterkey" prop present will be considered for filtering.

Reset Items after Initialization

If you want to reset Items after component mount. Make a reference to TableFilter node and call reset method as shown below.

<TableFilter
  rows={data}
  onFilterUpdate={this._filterUpdated}
  initialFilters={this.state.filterConfiguration}
  ref={ (node) => {this.tableFilterNode = node;}>

this.tableFilterNode.reset(newData, resetFilters);
Arguments Detail:
newData - Data to reset
resetFilters(Default: true) - Boolean tells component to maintain/reset existing filters

API

Properties

TableFilter

Name Type Default Required Description
rows array true Items for the Filter
onFilterUpdate function(updatedData, filterConfiguration) true Function called with filtered data and updated filter configuration
rowClass string false Any additional class to be added to table row contaning header columns
initialFilters Array false Initial Filter configuration to be applied. Configuration is received as second argument for onFilterUpdate function
rowComponent Component Table Row Element false The columns headers will by default be placed inside Table Row Element. If rowComponent is passed it will be used. Any react component can be used.

TableFilter Ref Methods

Name Type Description
reset function(items, resetFilters=true) Function called to reset items after component has been mounted. You can choose to either reset current filters or not.

Cloumn Headers(td/th)

Name Type Default Required Description
filterkey string false Key by which the Column should be filtered(Key as present in single Item)
itemDisplayValueFunc function(itemValue) false Optional Function that returns the Value that is displayed in the filter list for each item(Default is the item value - Item[key])
itemSortValueFunc function(itemValue) false Optional Function that returns the Value that is used while sorting (Default is the item value - Item[key])
alignleft string "false" false Decides while side filter list should be aligned w.r.t Column. Allowed "true"/"false"
casesensitive string "false" false Case Sensitivity during sort. Allowed "true"/"false"
showsearch string "true" false Display/Hide the search input. Allowed "true"/"false"

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].