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

pubcore-reducer-datatable

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pubcore-reducer-datatable

redux reducers to manage state of datatables

latest
Source
npmnpm
Version
1.0.6
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

Reduce redux actions to manipulate state of data tables

Prerequisites

Redux is used

Installation

npm install --save pubcore-reducer-datatable

Place it within your root-reducer or in any other slice reducer.

The slice-key (sk) is used to distinguish between other reducers, especially if you have more than one pubcore-reducer-datatable used on the page. It makes corresponding action types unique in context of your app.

import {sort} from pubcore-reducer-datatable
const initState = [{col:'firstname', order:'asc'}]

//[..]
combineReducer({
	//[..]
	sort:sort({sk:'sort', initState})
	//[..]
})

or for "columns":

import {columns} from pubcore-reducer-datatable
//[..]
const initState = {
	all:['name', 'birthday'],
	sequence:['name', 'birthday'],
	visible:['name']
}

combineReducer({
	//[..]
	columns:columns({sk:'tables.users.columns', initState})
})

1) sort

(multi) sort of table columns

state slice example

sort by firstname desc, birthday asc

//array of object
[
	{col:'firstname', order:'desc'},
	{col:'birthday', order:'asc'}
]

action examples (sk=='sort')

//change secondary sort order (priority=1) of column "birthday",
{type:'sort_TOGGLE_SORT', col:'birthday', priority:1}

//toggle sort order
//if no priorty is given, default priority is 0 (no multisort)
{type:'sort_TOGGLE_SORT', col:'firstname'}

2) columns

show/hide, change sequence of table columns

state slice example

{
	all:['firstname', 'birthday'],
	sequence:['birthday', 'firstname'],
	visible:['firstname']
}

redux action examples (sk=='columns')

{type:'columns_RESET', all, sequence, visible}

{type:'columns_CHANGE_COL_SEQUENCE', from:0, to:1}

{type:'columns_SHOW_COL', col:'birthday', isVisible:false}

FAQs

Package last updated on 20 Mar 2020

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