From 8188054e86e1fa0644a76edfc3b2825ffbf290b4 Mon Sep 17 00:00:00 2001 From: AllenFang Date: Sun, 4 Nov 2018 23:48:03 +0800 Subject: [PATCH] 20181104 release --- docs/basic-filter.md | 20 +++++++++++++++++++ docs/basic-row-select.md | 7 ++++++- docs/row-select-props.md | 26 ++++++++++++++++++++++++- website/blog/2018-11-04-version.bump.md | 23 ++++++++++++++++++++++ 4 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 website/blog/2018-11-04-version.bump.md diff --git a/docs/basic-filter.md b/docs/basic-filter.md index 08c6f55..5de86e5 100644 --- a/docs/basic-filter.md +++ b/docs/basic-filter.md @@ -121,6 +121,26 @@ const qualityFilter = selectFilter({ // omit... ``` +> Note, the `selectOptions` can be an array also: + ```js +const selectOptions = [ + { label: 0, value: 'good' }, + { label: 1, value: 'Bad' }, + { label: 2, value: 'unknown' } +]; +const columns = [ + ..., { + dataField: 'quality', + text: 'Product Quailty', + formatter: cell => selectOptions.find(opt => opt.label === cell).value, + filter: selectFilter({ + options: selectOptions + }) +}]; +``` + The benifit is `react-bootstrap-table2` will render the select options by the order of array. + + ## MultiSelect Filter Multi-select filter is almost same as regular select filterfilter : diff --git a/docs/basic-row-select.md b/docs/basic-row-select.md index 30af695..6d303cf 100644 --- a/docs/basic-row-select.md +++ b/docs/basic-row-select.md @@ -20,9 +20,14 @@ By default behavior, user need to click on the selection column or the checkbox/ ## Selection Management Please check [`selectoRow.selected`](./row-select-props.html#selectrowselected-array), it's used for default selection usually but also can be used as a external selection control. -This is an example for [selection management](../storybook/index.html?selectedKind=Row%20Selection&selectedStory=Selection%20Management) +This is an example for [selection management](../storybook/index.html?selectedKind=Row%20Selection&selectedStory=Selection%20Management). + + +In addition, this is another example for [selection management](../storybook/index.html?selectedKind=Row%20Selection&selectedStory=Advance%20Selection%20Management) ## Customization + + ### Style/Class Like column, we support to custom the style, class on the selecting row easily via following `selectRow` props: diff --git a/docs/row-select-props.md b/docs/row-select-props.md index 5753bb9..cbc05dd 100644 --- a/docs/row-select-props.md +++ b/docs/row-select-props.md @@ -183,18 +183,42 @@ const selectRow = { }; ``` +> If you want to reject current select action, just return `false`: + ```js +const selectRow = { + mode: 'checkbox', + onSelect: (row, isSelect, rowIndex, e) => { + if (SOME_CONDITION) { + return false; + } + } +}; +``` + ## selectRow.onSelectAll - [Function] This callback function will be called when select/unselect all and it only work when you configure [`selectRow.mode`](#selectrowmode-string) as `checkbox`. ```js const selectRow = { mode: 'checkbox', - onSelectAll: (isSelect, results, e) => { + onSelectAll: (isSelect, rows, e) => { // ... } }; ``` +> If you want to control the final selection result, just return a row key array: + ```js +const selectRow = { + mode: 'checkbox', + onSelectAll: (isSelect, rows, e) => { + if (isSelect && SOME_CONDITION) { + return [1, 3, 4]; // finally, key 1, 3, 4 will being selected + } + } +}; +``` + ## selectRow.hideSelectColumn - [Bool] Default is `false`, if you don't want to have a selection column, give this prop as `true` diff --git a/website/blog/2018-11-04-version.bump.md b/website/blog/2018-11-04-version.bump.md new file mode 100644 index 0000000..e04e822 --- /dev/null +++ b/website/blog/2018-11-04-version.bump.md @@ -0,0 +1,23 @@ +--- +title: New Release (2018-11-04) +author: Allen Fang +authorURL: https://twitter.com/allenfang_tw +--- + +## Changed Packages + +We got following package version bump in this release: + +* `react-bootstrap-table-next@1.4.0` +* `react-bootstrap-table2-editor@1.2.2` + + +## Changelog + +### Bug fixes + +### Features + +### Enhancements +* Allow to call `setState` in `selectRow.onSelect` and `selectRow.onSelectAll`([#644](https://github.com/react-bootstrap-table/react-bootstrap-table2/pull/644)) +* Allow to use array for select filter options([#646](https://github.com/react-bootstrap-table/react-bootstrap-table2/pull/646))