diff --git a/docs/README.md b/docs/README.md index ec5f593..dc9b54d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -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) ### keyField(**required**) - [String] Tells `react-bootstrap-table2` which column is unique. @@ -30,6 +32,20 @@ Provides data for your table. It accepts a single Array object. ### columns(**required**) - [Object] Accepts a single Array object, please see [columns definition](./columns.md) for more detail. +### remote - [Bool | Object] +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. + ### caption - [String | Node] 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 }) ``` + +### onTableChange - [Function] +This callback function will be called when [`remote`](#remote) enabled only. + +```js +const onTableChange = (newState) => { + // handle any data change here +} + +``` + +There's only one argument will be passed to `onTableChange`, `newState`: + +```js +{ + page, // newest page + sizePerPage //newest sizePerPage +} +``` \ No newline at end of file