mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2026-07-01 14:40:02 +00:00
20190721 release
This commit is contained in:
@@ -39,7 +39,10 @@ This is an example for [manage on expands](../storybook/index.html?selectedKind=
|
||||
## Customization
|
||||
|
||||
### Style/Class
|
||||
`expandRow.renderer` allow you to render everything in the content of expanding row. You can control the style or class by yourself. However, a expand row is wrapped by a HTML `tr` element. Currently, we don't support any ways to custom the style or class on the expanding `tr` elemnt.
|
||||
`expandRow.renderer` allow you to render everything in the content of expanding row. You can control the style or class by yourself. However, a expand row is wrapped by a HTML `tr` element(Parent row). Currently, we support following way to custom the class/style on parent row element:
|
||||
|
||||
* For the class of parent row: [`expandRow.parentClassName`](./row-expand-props.html#expandrowparentclassname-string-function)
|
||||
* For the style of parent row: N/A
|
||||
|
||||
### Expand Column
|
||||
`react-bootstrap-table2` default doesn't render a additional indicator column, just like row selection. But if you want it, you can enable it via [`expandRow.showExpandColumn`](./row-expand-props.html#expandrowshowexpandcolumn-bool)
|
||||
|
||||
@@ -11,6 +11,7 @@ Definition of columns props on BootstrapTable
|
||||
|
||||
## Optional
|
||||
* [isDummyField](#columnisdummyfield-bool)
|
||||
* [type](#columntype-string)
|
||||
* [hidden](#columnhidden-bool)
|
||||
* [formatter](#columnformatter-function)
|
||||
* [formatExtraData](#columnformatextradata-any)
|
||||
@@ -80,6 +81,10 @@ dataField: 'address.city'
|
||||
## column.text (**required**) - [String]
|
||||
`text` will be the column text in header column by default, if your header is not only text or you want to customize the header column, please check [`column.headerFormatter`](#columnheaderformatter-function)
|
||||
|
||||
## column.type - [String]
|
||||
Specify the data type on column. Available value so far is `string`, `number`, `bool` and `date`. Default is `string`.
|
||||
`column.type` can be used when you enable the cell editing and want to save your cell data with correct data type.
|
||||
|
||||
## column.isDummyField - [Bool]
|
||||
Sometime, you just want to have a column which is not perform any data but just some action components. In this situation, we suggest you to use `isDummyField`. If column is dummy, the [`column.dataField`](#dataField) can be any string value, cause of it's meaningless. However, please keep `dataField` as unique as possible.
|
||||
|
||||
|
||||
@@ -20,17 +20,21 @@ title: Row Expand Props
|
||||
* [expandColumnPosition](#expandrowexpandcolumnposition-string)
|
||||
* [expandColumnRenderer](#expandrowexpandcolumnrenderer-function)
|
||||
* [expandHeaderColumnRenderer](#expandrowexpandheadercolumnrenderer-function)
|
||||
* [parentClassName](#expandrowparentclassname-string-function)
|
||||
|
||||
-----
|
||||
|
||||
## expandRow.renderer - [Function]
|
||||
|
||||
Specify the content of expand row, `react-bootstrap-table2` will pass the currnet row object as argument and expect this function to return a react element.
|
||||
Specify the content of expand row, `react-bootstrap-table2` will pass the two arguments and expect to return a react element:
|
||||
|
||||
* `row`: Currnet row data.
|
||||
* `rowIndex`: Currnet row index.
|
||||
|
||||
|
||||
```js
|
||||
const expandRow = {
|
||||
renderer: row => (
|
||||
renderer: (row, rowIndex) => (
|
||||
<div>
|
||||
<p>{ `This Expand row is belong to rowKey ${row.id}` }</p>
|
||||
<p>You can render anything here, also you can add additional data on every row object</p>
|
||||
@@ -176,4 +180,25 @@ const expandRow = {
|
||||
// ....
|
||||
)
|
||||
};
|
||||
```
|
||||
```
|
||||
|
||||
## expandRow.parentClassName - [String | Function]
|
||||
Apply the custom class name on parent row of expanded row. For example:
|
||||
|
||||
```js
|
||||
const expandRow = {
|
||||
renderer: (row) => ...,
|
||||
parentClassName: 'foo'
|
||||
};
|
||||
```
|
||||
Below case is more flexible way to custom the class name:
|
||||
|
||||
```js
|
||||
const expandRow = {
|
||||
renderer: (row) => ...,
|
||||
parentClassName: (isExpanded, row, rowIndex) => {
|
||||
if (rowIndex > 2) return 'foo';
|
||||
return 'bar';
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user