mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2025-10-16 11:55:39 +00:00
* implement table sort * path for component test for table sort * add store/base test * add store/sort test * add story for sort * add column.sort and column.sortFunc
45 lines
864 B
JavaScript
45 lines
864 B
JavaScript
import React from 'react';
|
|
|
|
import { BootstrapTableful } from 'react-bootstrap-table2';
|
|
import Code from 'components/common/code-block';
|
|
import { productsGenerator } from 'utils/common';
|
|
|
|
const products = productsGenerator();
|
|
|
|
const columns = [{
|
|
dataField: 'id',
|
|
text: 'Product ID',
|
|
sort: true
|
|
}, {
|
|
dataField: 'name',
|
|
text: 'Product Name',
|
|
sort: true
|
|
}, {
|
|
dataField: 'price',
|
|
text: 'Product Price'
|
|
}];
|
|
|
|
const sourceCode = `\
|
|
const columns = [{
|
|
dataField: 'id',
|
|
text: 'Product ID',
|
|
sort: true
|
|
}, {
|
|
dataField: 'name',
|
|
text: 'Product Name',
|
|
sort: true
|
|
}, {
|
|
dataField: 'price',
|
|
text: 'Product Price'
|
|
}];
|
|
|
|
<BootstrapTableful keyField='id' data={ products } columns={ columns } />
|
|
`;
|
|
|
|
export default () => (
|
|
<div>
|
|
<BootstrapTableful keyField="id" data={ products } columns={ columns } />
|
|
<Code>{ sourceCode }</Code>
|
|
</div>
|
|
);
|