mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2025-10-16 11:55:39 +00:00
patch docs for remote
This commit is contained in:
parent
70303617fb
commit
fab06bf599
@ -8,6 +8,7 @@
|
||||
* [columns (**required**)](#columns)
|
||||
|
||||
#### Optional
|
||||
* [remote](#remote)
|
||||
* [caption](#caption)
|
||||
* [striped](#striped)
|
||||
* [bordered](#bordered)
|
||||
@ -20,6 +21,7 @@
|
||||
* [rowEvents](#rowEvents)
|
||||
* [defaultSorted](#defaultSorted)
|
||||
* [pagination](#pagination)
|
||||
* [onTableChange](#onTableChange)
|
||||
|
||||
### <a name='keyField'>keyField(**required**) - [String]</a>
|
||||
Tells `react-bootstrap-table2` which column is unique.
|
||||
@ -30,6 +32,20 @@ Provides data for your table. It accepts a single Array object.
|
||||
### <a name='columns'>columns(**required**) - [Object]</a>
|
||||
Accepts a single Array object, please see [columns definition](./columns.md) for more detail.
|
||||
|
||||
### <a name='remote'>remote - [Bool | Object]</a>
|
||||
Default is `false`, if enable`remote`, you are suppose to handle all the table change events, like: pagination, insert, filtering etc.
|
||||
This is a chance that you can connect to your remote server or database to manipulate your data.
|
||||
For flexibility reason, you can control what functionality should be handled on remote via a object return:
|
||||
|
||||
```js
|
||||
remote={ { pagination: true } }
|
||||
```
|
||||
|
||||
In above case, only pagination will be handled on remote.
|
||||
|
||||
> Note: when remote is enable, you are suppose to give [`onTableChange`](#onTableChange) prop on `BootstrapTable`
|
||||
> It's the only way to communicate to your remote server and update table states.
|
||||
|
||||
### <a name='caption'>caption - [String | Node]</a>
|
||||
Same as HTML [caption tag](https://www.w3schools.com/TAgs/tag_caption.asp), you can set it as String or a React JSX.
|
||||
|
||||
@ -148,3 +164,22 @@ paginator({
|
||||
hidePageListOnlyOnePage: true// hide pagination bar when only one page, default is false
|
||||
})
|
||||
```
|
||||
|
||||
### <a name='onTableChange'>onTableChange - [Function]</a>
|
||||
This callback function will be called when [`remote`](#remote) enabled only.
|
||||
|
||||
```js
|
||||
const onTableChange = (newState) => {
|
||||
// handle any data change here
|
||||
}
|
||||
<BootstrapTable data={ data } columns={ columns } onTableChange={ onTableChange } />
|
||||
```
|
||||
|
||||
There's only one argument will be passed to `onTableChange`, `newState`:
|
||||
|
||||
```js
|
||||
{
|
||||
page, // newest page
|
||||
sizePerPage //newest sizePerPage
|
||||
}
|
||||
```
|
||||
Loading…
Reference in New Issue
Block a user