Skip to content

Commit 2fbc84e

Browse files
committed
pathc docs for remote mode
1 parent c4eb2f8 commit 2fbc84e

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

docs/README.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,21 @@ This is a chance that you can connect to your remote server or database to manip
4040
For flexibility reason, you can control what functionality should be handled on remote via a object return:
4141

4242
```js
43-
remote={ { pagination: true } }
43+
remote={ { filter: true } }
4444
```
4545

46-
In above case, only pagination will be handled on remote.
46+
In above case, only column filter will be handled on remote.
4747

4848
> Note: when remote is enable, you are suppose to give [`onTableChange`](#onTableChange) prop on `BootstrapTable`
4949
> It's the only way to communicate to your remote server and update table states.
5050
51+
A special case for remote pagination:
52+
```js
53+
remote={ { pagination: true, filter: false, sort: false } }
54+
```
55+
56+
In pagination case, even you only specified the paignation need to handle as remote, `react-bootstrap-table2` will handle all the table changes(`filter`, `sort` etc) as remote mode, because `react-bootstrap-table` only know the data of current page, but filtering, searching or sort need to work on overall datas.
57+
5158
### <a name='loading'>loading - [Bool]</a>
5259
Telling if table is loading or not, for example: waiting data loading, filtering etc. It's **only** valid when [`remote`](#remote) is enabled.
5360
When `loading` is `true`, `react-bootstrap-table` will attend to render a overlay on table via [`overlay`](#overlay) prop, if [`overlay`](#overlay) prop is not given, `react-bootstrap-table` will ignore the overlay rendering.
@@ -230,17 +237,25 @@ const columns = [ {
230237
This callback function will be called when [`remote`](#remote) enabled only.
231238

232239
```js
233-
const onTableChange = (newState) => {
240+
const onTableChange = (type, newState) => {
234241
// handle any data change here
235242
}
236243
<BootstrapTable data={ data } columns={ columns } onTableChange={ onTableChange } />
237244
```
238245

239-
There's only one argument will be passed to `onTableChange`, `newState`:
246+
There's only two arguments will be passed to `onTableChange`: `type` and `newState`:
247+
248+
`type` is tell you what kind of functionality to trigger this table's change: available values at the below:
249+
250+
* `filter`
251+
* `pagination`
252+
253+
Following is a shape of `newState`
240254

241255
```js
242256
{
243257
page, // newest page
244-
sizePerPage //newest sizePerPage
258+
sizePerPage, //newest sizePerPage
259+
filters // an object which have current filter status per column
245260
}
246261
```

0 commit comments

Comments
 (0)