* implement column.hidden

* add story for column.hidden

* add docs for column.hidden
This commit is contained in:
Allen
2017-09-02 02:36:26 -05:00
committed by GitHub
parent 60d4e7e5d2
commit 6f45ae7886
7 changed files with 102 additions and 0 deletions
@@ -0,0 +1,50 @@
/* eslint no-unused-vars: 0 */
import React from 'react';
import { BootstrapTable } from 'react-bootstrap-table2';
const products = [];
function addProducts(quantity) {
const startId = products.length;
for (let i = 0; i < quantity; i += 1) {
const id = startId + i;
products.push({
id,
name: `Item name ${id}`,
price: 2100 + i
});
}
}
addProducts(5);
const columns = [{
dataField: 'id',
text: 'Product ID',
hidden: true
}, {
dataField: 'name',
text: 'Product Name'
}, {
dataField: 'price',
text: 'Product Price'
}];
export default () => (
<div>
<BootstrapTable keyField="id" data={ products } columns={ columns } />
<pre className="prettyprint lang-js"><code className="language-javascript">{`
const columns = [{
dataField: 'id',
text: 'Product ID',
hidden: true
},
// omit...
];
<BootstrapTable keyField='id' data={ products } columns={ columns } />
`}
</code></pre>
</div>
);