Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rc-table

Package Overview
Dependencies
Maintainers
2
Versions
440
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-table - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

41

lib/Table.js

@@ -173,6 +173,14 @@ 'use strict';

}
return React.createElement(
'div',
{ className: className, style: props.style },
var headerTable;
var thead = React.createElement(
'thead',
{ className: prefixCls + '-thead' },
React.createElement(
'tr',
null,
columns
)
);
if (props.useFixedHeader) {
headerTable = React.createElement(
'div',

@@ -184,13 +192,11 @@ { className: prefixCls + '-header' },

this.getColGroup(),
React.createElement(
'thead',
null,
React.createElement(
'tr',
null,
columns
)
)
thead
)
),
);
thead = null;
}
return React.createElement(
'div',
{ className: className, style: props.style },
headerTable,
React.createElement(

@@ -203,5 +209,6 @@ 'div',

this.getColGroup(),
thead,
React.createElement(
'tbody',
null,
{ className: prefixCls + '-tbody' },
rows

@@ -219,2 +226,3 @@ )

Table.propTypes = {
useFixedHeader: React.PropTypes.bool,
columns: React.PropTypes.array,

@@ -224,2 +232,3 @@ prefixCls: React.PropTypes.string,

style: React.PropTypes.object,
rowKey: React.PropTypes.func,
childrenColumnName: React.PropTypes.string

@@ -229,3 +238,7 @@ };

Table.defaultProps = {
useFixedHeader: false,
columns: [],
rowKey: function rowKey(o) {
return o.key;
},
prefixCls: 'rc-table',

@@ -232,0 +245,0 @@ bodyStyle: {},

{
"name": "rc-table",
"version": "3.0.0",
"version": "3.0.1",
"description": "table ui component for react",

@@ -43,3 +43,3 @@ "keywords": [

"precommit-hook": "^1.0.7",
"rc-dropdown": "~1.1.0",
"rc-dropdown": "~1.1.2",
"rc-menu": "~3.4.0",

@@ -46,0 +46,0 @@ "rc-server": "3.x",

@@ -46,18 +46,27 @@ # rc-table

```js
var React = require('react');
var Table = require('rc-table');
require('rc-table/assets/index.css');
var columns = [
{title : 'header 1',dataIndex :'a', width:100},
{id: '123',title : 'header 2',dataIndex :'b', width:100},
{title : 'header 3',dataIndex : 'c',width:200},
{title : 'operate',dataIndex : '',renderer :function (value,obj) {
return <a href="#">edit</a>
}}
{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'},{a:'cdd',b:'edd'},{a:'1333',c:'eee',d:2}];
var data = [{a: '123',key:'1'}, {a: 'cdd', b: 'edd',key:'2'}, {a: '1333', c: 'eee', d: 2,key:'3'}];
React.renderComponent(
<Table columns={columns} data={data} className="table"/>,
document.getElementById('t1')
var table = React.render(
<div>
<h2>simple table</h2>
<Table columns={columns}
data={data}
className="table"/>
</div>,
document.getElementById('__react-content')
);

@@ -69,22 +78,59 @@ ```

#### rowKey
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">name</th>
<th style="width: 50px;">type</th>
<th>default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>prefixCls</td>
<td>String</td>
<th>rc-table</th>
<td></td>
</tr>
<tr>
<td>className</td>
<td>String</td>
<th></th>
<td>additional className</td>
</tr>
<tr>
<td>useFixedHeader</td>
<td>Boolean</td>
<th>false</th>
<td>whether use separator table for header. better set width for columns</td>
</tr>
<tr>
<td>rowKey</td>
<td>Function(recode):string</td>
<th>record.key</th>
<td>default use record.key as rowKey</td>
</tr>
<tr>
<td>data</td>
<td>Array<Object></td>
<th></th>
<td>data record array to be rendered</td>
</tr>
<tr>
<td>columns</td>
<td>Array<Object></td>
<th></th>
<td>
The columns config of table. contains
`Function(recode):string`
* key : key of this column
* title : The title of column
* dataIndex : display the data field
* width : The width of column. The width of the specific proportion calculation according to the width of the columns
* renderer : The render function of cell , has two params. value : the text of this cell;obj : the record of this row
</td>
</tr>
</tbody>
</table>
* get key value of each row from each row record data
#### columns
* The columns config of table
* key : key of this column
* title : The title of column
* dataIndex : display the data field
* width : The width of column. The width of the specific proportion calculation according to the width of the columns
* renderer : The render function of cell , has two params. value : the text of this cell;obj : the record of this row
#### data
* The Data to be shown
#### className
* The css class this table to be used
## Test Case

@@ -91,0 +137,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc