* implement custom row classes

* add story for customizing row classes

* add test for rowClasses

* patch docs for rowClasses
This commit is contained in:
Allen
2017-10-30 14:24:39 +08:00
committed by GitHub
parent 19dc4d3984
commit 6110663075
8 changed files with 207 additions and 9 deletions

View File

@@ -16,6 +16,7 @@
* [cellEdit](#cellEdit)
* [selectRow](#selectRow)
* [rowStyle](#rowStyle)
* [rowClasses](#rowClasses)
* [defaultSorted](#defaultSorted)
### <a name='keyField'>keyField(**required**) - [String]</a>
@@ -62,6 +63,23 @@ const rowStyle = (row, rowIndex) => {
<BootstrapTable data={ ... } columns={ ... } rowStyle={ rowStyle } />
```
### <a name='rowClasses'>rowClasses = [String | Function]</a>
Custom the style of table rows:
```js
<BootstrapTable data={ ... } columns={ ... } rowClasses="custom-row-class" />
```
This prop also accept a callback function for flexible to custom row style:
```js
const rowClasses = (row, rowIndex) => {
return 'custom-row-class';
};
<BootstrapTable data={ ... } columns={ ... } rowClasses={ rowClasses } />
```
### <a name='defaultSorted'>defaultSorted - [Array]</a>
`defaultSorted` accept an object array which allow you to define the default sort columns when first render.