Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
pathc docs for remote mode
  • Loading branch information
AllenFang committed Dec 24, 2017
commit 2fbc84e36e3468b77c691161e244fbeb7d5ba96b
25 changes: 20 additions & 5 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,21 @@ This is a chance that you can connect to your remote server or database to manip
For flexibility reason, you can control what functionality should be handled on remote via a object return:

```js
remote={ { pagination: true } }
remote={ { filter: true } }
```

In above case, only pagination will be handled on remote.
In above case, only column filter 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 special case for remote pagination:
```js
remote={ { pagination: true, filter: false, sort: false } }
```

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.

### <a name='loading'>loading - [Bool]</a>
Telling if table is loading or not, for example: waiting data loading, filtering etc. It's **only** valid when [`remote`](#remote) is enabled.
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.
Expand Down Expand Up @@ -230,17 +237,25 @@ const columns = [ {
This callback function will be called when [`remote`](#remote) enabled only.

```js
const onTableChange = (newState) => {
const onTableChange = (type, newState) => {
// handle any data change here
}
<BootstrapTable data={ data } columns={ columns } onTableChange={ onTableChange } />
```

There's only one argument will be passed to `onTableChange`, `newState`:
There's only two arguments will be passed to `onTableChange`: `type` and `newState`:

`type` is tell you what kind of functionality to trigger this table's change: available values at the below:

* `filter`
* `pagination`

Following is a shape of `newState`

```js
{
page, // newest page
sizePerPage //newest sizePerPage
sizePerPage, //newest sizePerPage
filters // an object which have current filter status per column
}
```