From 9bc25c9d3ef3c00e0a46c6b4edf086389f1f77d5 Mon Sep 17 00:00:00 2001 From: AllenFang Date: Sat, 3 Nov 2018 16:45:05 +0800 Subject: [PATCH] patch docs for selection control --- docs/row-selection.md | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/docs/row-selection.md b/docs/row-selection.md index 9a09361..c8b97e3 100644 --- a/docs/row-selection.md +++ b/docs/row-selection.md @@ -211,18 +211,44 @@ 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`](#mode) 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`