-
Notifications
You must be signed in to change notification settings - Fork 763
Expand file tree
/
Copy pathbasic-table.js
More file actions
32 lines (27 loc) · 868 Bytes
/
basic-table.js
File metadata and controls
32 lines (27 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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(50);
export default class BasicTable extends React.Component {
render() {
return (
<BootstrapTable data={ products } height='500px'>
<TableHeaderColumn dataField='id' isKey={ true } width='10%'>Product ID</TableHeaderColumn>
<TableHeaderColumn dataField='name' width='65%'>Product Name</TableHeaderColumn>
<TableHeaderColumn dataField='price' width='25%'>Product Price</TableHeaderColumn>
</BootstrapTable>
);
}
}