File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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" ,
Original file line number Diff line number Diff line change @@ -14,6 +14,16 @@ import './App.css';
1414
1515class 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 >
Original file line number Diff line number Diff line change 11import React , { Component } from 'react' ;
22import Table from 'react-bootstrap/Table' ;
33import './DataTable.css'
4+ import BootstrapTable from 'react-bootstrap-table-next' ;
45class 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}
You can’t perform that action at this time.
0 commit comments