Skip to content

This is the repository for my sortable table implementation.

Notifications You must be signed in to change notification settings

Dadidam/sort-table

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sort Table

Sort Table is a ReactJS component that allows you to create a sortable table just by passing in a basic JSON array of objects. The first layer of the JSON objects in the array needs to contain sortable items (ie integers, floats, strings, etc.) I have not tried with nested objects so use those at your own risk.


Basic Useage

To use the component pass a JSON array similar to:

var els = JSON.stringify([
	{
		"name": "Buster",
		"age": 34,
		"occupation": "army"
	},
	{
		"name": "Lindsay",
		"age": 37,
		"occupation": "socialite"
	},
	{
		"name": "G.O.B.",
		"age": 36,
		"occupation": "illusionist"
	}
]);

Next, pass this object to the component:


<SortTable elements={els} />

Advanced Options

You can specify which columns you want to show on the table by passing an array of strings to the keys attribute:


<SortTable keys={['name', 'age']} elements={els} />

Note: If you do not pass in the keys attribute, the component will assume the keys of the first element in the array are the columns.

About

This is the repository for my sortable table implementation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published