Skip to content

Commit

Permalink
add column title example
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenFang committed Jun 9, 2016
1 parent 4d25667 commit adfcf00
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
32 changes: 32 additions & 0 deletions examples/js/column/column-title-table.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/* eslint max-len: 0 */
import React from 'react';
import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table';


const products = [];

function addProducts(quantity) {
const startId = products.length;
for (let i = 0; i < quantity; i++) {
const id = startId + i;
products.push({
id: id,
name: 'Item name ' + id,
price: 2100 + i
});
}
}

addProducts(5);

export default class ColumnAlignTable extends React.Component {
render() {
return (
<BootstrapTable data={ products }>
<TableHeaderColumn dataField='id' isKey={ true }>Product ID</TableHeaderColumn>
<TableHeaderColumn dataField='name' columnTitle={ true }>Product Name</TableHeaderColumn>
<TableHeaderColumn dataField='price' columnTitle={ true }>Product Price</TableHeaderColumn>
</BootstrapTable>
);
}
}
10 changes: 10 additions & 0 deletions examples/js/column/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React from 'react';
import ColumnAlignTable from './column-align-table';
import ColumnWidthTable from './column-width-table';
import ColumnHideTable from './column-hide-table';
import ColumnTitleTable from './column-title-table';

class Demo extends React.Component {
render() {
Expand Down Expand Up @@ -35,6 +36,15 @@ class Demo extends React.Component {
</div>
</div>
</div>
<div className='col-md-offset-1 col-md-8'>
<div className='panel panel-default'>
<div className='panel-heading'>Column Title Example</div>
<div className='panel-body'>
<h5>Source in /examples/js/column/column-title-table.js</h5>
<ColumnTitleTable />
</div>
</div>
</div>
</div>
);
}
Expand Down

0 comments on commit adfcf00

Please sign in to comment.