Skip to content

Commit 89952b6

Browse files
committed
new bootstrap table, working on adding props to route
1 parent 8995c1e commit 89952b6

3 files changed

Lines changed: 33 additions & 30 deletions

File tree

duct-drone-app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"prop-types": "^15.7.2",
3131
"react": "^16.8.5",
3232
"react-bootstrap": "^1.0.0-beta.6",
33+
"react-bootstrap-table-next": "^3.1.0",
3334
"react-dom": "^16.8.5",
3435
"react-joystick-component": "^1.4.0",
3536
"react-nipple": "^1.0.1",

duct-drone-app/src/App.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ import './App.css';
1414

1515
class App extends Component {
1616
render() {
17+
const columns = [{
18+
dataField: 'id',
19+
text: 'Product ID'
20+
}, {
21+
dataField: 'name',
22+
text: 'Product Name'
23+
}, {
24+
dataField: 'price',
25+
text: 'Product Price'
26+
}];
1727
return(
1828
<Router>
1929
<Container>

duct-drone-app/src/DataTable.js

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,31 @@
11
import React, { Component } from 'react';
22
import Table from 'react-bootstrap/Table';
33
import './DataTable.css'
4+
import BootstrapTable from 'react-bootstrap-table-next';
45
class DataTable extends React.Component {
5-
// constructor(props) {
6-
7-
// }
6+
constructor(props) {
7+
super(props);
8+
console.log(props.columns);
9+
}
810
render() {
9-
var isActive = false;
11+
// const columns = [{
12+
// dataField: 'id',
13+
// text: 'Product ID'
14+
// }, {
15+
// dataField: 'name',
16+
// text: 'Product Name'
17+
// }, {
18+
// dataField: 'price',
19+
// text: 'Product Price'
20+
// }];
21+
const products = [{
22+
id: 23,
23+
name: "cheese",
24+
price: 23.23
25+
26+
}];
1027
return (
11-
<Table responsive bordered="true" striped bordered size="sm">
12-
<thead>
13-
<tr>
14-
<th>#</th>
15-
<th>Table heading</th>
16-
<th>Table heading</th>
17-
</tr>
18-
</thead>
19-
<tbody>
20-
<tr>
21-
<td>1</td>
22-
<td>Table cell</td>
23-
<td>Table cell</td>
24-
</tr>
25-
<tr>
26-
<td>2</td>
27-
<td>Table cell</td>
28-
<td>Table cell</td>
29-
</tr>
30-
<tr>
31-
<td>3</td>
32-
<td>Table cell</td>
33-
<td>Table cell</td>
34-
</tr>
35-
</tbody>
36-
</Table>
28+
<BootstrapTable keyField='id' data={ products } columns={ this.props.columns } />
3729
);
3830
}
3931
}

0 commit comments

Comments
 (0)