GithubHelp home page GithubHelp logo

table's Introduction

rc-table

react table component

NPM version build status Test coverage gemnasium deps node version npm download

install

rc-table

Development

npm install
npm start

Example

http://localhost:8000/examples/

online example: http://react-component.github.io/table/examples/

Usage

var React = require('react');
var Table = require('rc-table');
require('rc-table/assets/index.css');

var columns = [
  {title: '表头1', dataIndex: 'a', key:'a',width: 100},
  {id: '123', title: '表头2', dataIndex: 'b', key:'b', width: 100},
  {title: '表头3', dataIndex: 'c',  key:'c',width: 200},
  {
    title: '操作', dataIndex: '',  key:'d',render: function () {
    return <a href="#">操作</a>
  }
  }
];

var data = [{a: '123',key:'1'}, {a: 'cdd', b: 'edd',key:'2'}, {a: '1333', c: 'eee', d: 2,key:'3'}];

var table = React.render(
  <div>
    <h2>simple table</h2>
    <Table columns={columns}
      data={data}
      className="table"/>
  </div>,
  document.getElementById('__react-content')
);

API

property

name type default description
prefixCls String rc-table
className String additional className
useFixedHeader Boolean false whether use separator table for header. better set width for columns
expandIconAsCell Boolean false whether render expandIcon as a cell
rowKey Function(recode,index):string record.key default use record.key as rowKey
rowClassName Function(recode,index):string get row's className
expandedRowClassName Function(recode,index):string get expanded row's className
data Array data record array to be rendered
columns Array The columns config of table. contains
name type default description
key String key of this column
className String className of this column
title React Node title of this column
dataIndex String display field of the data record
width String|Number he width of the specific proportion calculation according to the width of the columns
renderer Function(value, record) The render function of cell, has two params: the text of this cell and the record of this row

Test Case

http://localhost:8000/tests/runner.html?coverage

Coverage

http://localhost:8000/node_modules/rc-server/node_modules/node-jscover/lib/front-end/jscoverage.html?w=http://localhost:8000/tests/runner.html?coverage

License

rc-table is released under the MIT license.

table's People

Contributors

yiminghe avatar zhujun24 avatar dxq613 avatar popomore 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.