Code Monkey home page Code Monkey logo

react-data-grid's Introduction

multi-select-react

Description

A React data grid.


Installation

npm link from build folder.
npm link npm link react-data-table

1. Basic Usage

import React, { Component } from 'react';
import  ReactDataTable  from 'react-data-table';

class MyComponent extends Component {
  constructor() {
        super();
        this.state = {
      activePage: 1,
      itemPerPage: 5,
      header: [
        {
          name: 'First Name',
          key: "first_name",
          filter: false,
          colNum: 0,
          sort: true,
        },
        {
          name: 'Last Name',
          key: "last_name",
          filter: false,
          colNum: 1,
          sort: true,
        },
        {
          name: 'Gender',
          key: "gender",
          filter: true,
          colNum: 2,
          sort: false,
          filterArr: ["Male", "Female", "Ignore"]
        },
        {
          name: 'Occupation',
          key: "occupation",
          filter: true,
          colNum: 3,
          sort: false,
          filterArr: ["student", "working"]
        },
        {
          name: 'Hobbies',
          key: "hobbies",
          filter: true,
          colNum: 4,
          sort: false,
          filterArr: ["music", "reading", "sport"]
        }
      ],
      list: [
        [
          { "cntrlType": "input", "key": "first_name", "value": "Gracie", "toBeDisplay": true },
          { "cntrlType": "data", "key": "last_name", "value": "Tremayle", "toBeDisplay": true },
          { "cntrlType": "select", "key": "gender", "value": "Female", "options": ["Male", "Female", "Ignore"], "toBeDisplay": true },
          { "cntrlType": "radio", "key": "occupation", "value": "student", "options": ["student", "working"], "toBeDisplay": true },
          { "cntrlType": "check", "key": "hobbies", "value": ["music", "reading"], "optionsArr": ["music", "reading", "sport"], "toBeDisplay": true }
        ], [
          { "cntrlType": "input", "key": "first_name", "value": "Cyril", "toBeDisplay": true },
          { "cntrlType": "data", "key": "last_name", "value": "Choppin", "toBeDisplay": true },
          { "cntrlType": "select", "key": "gender", "value": "Male", "options": ["Male", "Female", "Ignore"], "toBeDisplay": true },
          { "cntrlType": "radio", "key": "occupation", "value": "working", "options": ["student", "working"], "toBeDisplay": true },
          { "cntrlType": "check", "key": "hobbies", "value": ["music", "reading"], "optionsArr": ["music", "reading", "sport"], "toBeDisplay": true }
        ]]
    }
    }
  render() {
    return (
      <ReactDataTable
        list={this.state.list}
        itemPerPage={this.state.itemPerPage}
        header={this.state.header} />
    );
  }

}

Default value for isTextWarp is true, for component to grow vertically and display all options selected set isTextWarp to false.


Props

Prop Type Default Description
list Array of Array R List of the data to be display
itemPerPage Number R Number of item per page
custom-classes Css class Optional Can be used to override the component.

react-data-grid's People

Contributors

ganesh-91 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.