|
| 1 | +# Migration Guide |
| 2 | + |
| 3 | +* Please see the [CHANGELOG](https://react-bootstrap-table.github.io/react-bootstrap-table2/blog/2018/01/24/new-version-0.1.0.html) for `react-bootstrap-table2` first drop. |
| 4 | +* Please see the [Roadmap](https://react-bootstrap-table.github.io/react-bootstrap-table2/blog/2018/01/24/release-plan.html) for `react-bootstrap-table2` in 2018/Q1. |
| 5 | +* Feel free to see the [offical docs](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/about.html), we list all the basic usage here!! |
| 6 | + |
| 7 | +## Preface |
| 8 | + |
| 9 | +Currently, **I still can't implement all the mainly features in legacy `react-bootstrap-table`**, so please watch our github repo or [blog](https://react-bootstrap-table.github.io/react-bootstrap-table2/blog/) to make sure the legacy features you wanted are already implemented on `react-bootstrap-table2`. Anyway, ask me by open issue is ok. |
| 10 | + |
| 11 | +----- |
| 12 | + |
| 13 | +`react-bootstrap-table2` separate some functionalities from core modules to other modules like following: |
| 14 | + |
| 15 | +* [`react-bootstrap-table2-next`](https://www.npmjs.com/package/react-bootstrap-table-next) |
| 16 | + * Core table module, include sorting and row selection |
| 17 | +* [`react-bootstrap-table2-filter`](https://www.npmjs.com/package/react-bootstrap-table2-filter) |
| 18 | + * Column filter Addons |
| 19 | +* [`react-bootstrap-table2-editor`](https://www.npmjs.com/package/react-bootstrap-table2-editor) |
| 20 | + * Cell Editing Addons |
| 21 | +* [`react-bootstrap-table2-paginator`](https://www.npmjs.com/package/react-bootstrap-table2-paginator) |
| 22 | + * Pagination Addons |
| 23 | +* [`react-bootstrap-table2-overlay`](https://www.npmjs.com/package/react-bootstrap-table2-overlay) |
| 24 | + * Overlay/Loading Addons |
| 25 | + |
| 26 | +This can help your application with less bundled size and also help `react-bootstrap-table2` have clean design to avoid handling to much logic in kernal module(SRP). Hence, which means you probably need to install above addons when you need specific features. |
| 27 | + |
| 28 | +## Core Table Migration |
| 29 | + |
| 30 | +There is a big chagne is that there's no `TableHeaderColumn` in the `react-bootstrap-table2`, instead you are supposed to be define the `columns` prop on `BootstrapTable`: |
| 31 | + |
| 32 | +```js |
| 33 | +import BootstrapTable from 'react-bootstrap-table-next'; |
| 34 | + |
| 35 | +const columns = [{ |
| 36 | + dataField: 'id', |
| 37 | + text: 'Product ID' |
| 38 | +}, { |
| 39 | + dataField: 'name', |
| 40 | + text: 'Product Name' |
| 41 | +}, { |
| 42 | + dataField: 'price', |
| 43 | + text: 'Product Price' |
| 44 | +}]; |
| 45 | + |
| 46 | +<BootstrapTable keyField='id' data={ products } columns={ columns } /> |
| 47 | +``` |
| 48 | + |
| 49 | +The `text` property is just same as the children for the `TableHeaderColumn`, if you want to custom the header, there's a new property is: [`headerFormatter`](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/column-props.html#columnheaderformatter-function). |
| 50 | + |
| 51 | +* [`BootstrapTable` Definitation](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/table-props.html) |
| 52 | +* [Column Definitation](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/column-props.html) |
| 53 | + |
| 54 | +## Table Sort |
| 55 | + |
| 56 | +Please see [Work with table sort](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/basic-sort.html). |
| 57 | + |
| 58 | +- [x] Basic sorting |
| 59 | +- [x] Custom sort function |
| 60 | +- [x] Default Sort |
| 61 | +- [x] Remote mode |
| 62 | +- [x] Custom the sorting header |
| 63 | +- [ ] Custom the sort caret |
| 64 | +- [ ] Sort management |
| 65 | +- [ ] Multi sort |
| 66 | + |
| 67 | +Due to no `TableHeaderColumn` so that no `dataSort` here, please add [`sort`](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/column-props.html#columnsort-bool) property on column definitation. |
| 68 | + |
| 69 | +## Row Selection |
| 70 | + |
| 71 | +Please see [Work with selection](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/basic-row-select.html). |
| 72 | +Please see [available selectRow configurations](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/row-select-props.html). |
| 73 | + |
| 74 | +No huge change for row selection, but can not custom the selection column currently. Coming soon!!! |
| 75 | + |
| 76 | +## Column Filter |
| 77 | + |
| 78 | +Please see [Work with column filter](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/basic-filter.html). |
| 79 | +Please see [available filter configuration](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/filter-props.html). |
| 80 | + |
| 81 | +- [x] Text Filter |
| 82 | +- [x] Custom Text Filter |
| 83 | +- [x] Remote Filter |
| 84 | +- [ ] Custom Filter Component |
| 85 | +- [ ] Regex Filter |
| 86 | +- [ ] Select Filter |
| 87 | +- [ ] Number Filter |
| 88 | +- [ ] Date Filter |
| 89 | +- [ ] Array Filter |
| 90 | +- [ ] Programmatically Filter |
| 91 | + |
| 92 | +Remember to install [`react-bootstrap-table2-filter`](https://www.npmjs.com/package/react-bootstrap-table2-filter) firstly. |
| 93 | + |
| 94 | +Due to no `TableHeaderColumn` so that no `filter` here, please add [`filter`](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/column-props.html#columnfilter-object) property on column definitation and [`filter`](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/table-props.html#filter-object) prop on `BootstrapTable`. |
| 95 | + |
| 96 | +## Cell Edit |
| 97 | + |
| 98 | +Please see [Work with cell edit](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/basic-celledit.html). |
| 99 | +Please see [available cell edit configurations](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/cell-edit-props.html). |
| 100 | + |
| 101 | +Remember to install [`react-bootstrap-table2-editor`](https://www.npmjs.com/package/react-bootstrap-table2-editor) firstly. |
| 102 | + |
| 103 | +No big changes for cell editing, [`validator`](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/column-props.html#columnvalidator-function) will not support the async call(Promise). |
| 104 | + |
| 105 | +## Pagination |
| 106 | + |
| 107 | +Please see [Work with pagination](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/basic-pagination.html). |
| 108 | +Please see [available pagination configurations](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/pagination-props.html). |
| 109 | + |
| 110 | +Remember to install [`react-bootstrap-table2-paginator`](https://www.npmjs.com/package/react-bootstrap-table2-paginator) firstly. |
| 111 | + |
| 112 | +No big changes for pagination, but still can't custom the pagination list, button and sizePerPage dropdown. |
| 113 | + |
| 114 | +## Remote |
| 115 | + |
| 116 | +> It's totally different in `react-bootstrap-table2`. Please [see](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/basic-remote.html). |
0 commit comments