You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Added support for single select in tree dropdown (#217)
## What does it do?
Adds support for single select in the tree dropdown. Simple select ignores any children so this is a hybrid between the two.
Also ignores clicks for simple select when labels are disabled (only checked readonly)
The middle dropdown is radioSelect and the last one a simpleSelect
https://ellinge.github.io/react-dropdown-tree-select-test/#DevelopTemp-checkeddefaultFixes#119
## Type of change
- [x] Bug fix
- [x] New feature
ReactDOM.render(<DropdownTreeSelect data={data} onChange={onChange} onAction={onAction} onNodeToggle={onNodeToggle} />, document.body) // in real world, you'd want to render to an element, instead of body.
) // in real world, you'd want to render to an element, instead of body.
163
168
```
164
169
165
170
## Props
@@ -219,7 +224,7 @@ Type: `function`
219
224
Fires when a action is triggered. Example:
220
225
221
226
```jsx
222
-
functiononAction({action, id}) {
227
+
functiononAction({action, id}) {
223
228
console.log(`onAction:: [${action}]`, id)
224
229
}
225
230
@@ -298,14 +303,32 @@ Type: `bool`
298
303
299
304
Displays children of found nodes to allow searching for a parent node on then selecting any child node of the found node. Defaults to `false`
300
305
301
-
*NOTE* this works only in combination with `keepTreeOnSearch`
306
+
_NOTE_ this works only in combination with `keepTreeOnSearch`
307
+
308
+
### keepOpenOnSelect
309
+
310
+
Type: `bool` (default: 'false')
311
+
312
+
Keeps single selects open after selection. Defaults to `false`
313
+
314
+
_NOTE_ this works only in combination with `simpleSelect` or `radioSelect`
302
315
303
316
### simpleSelect
304
317
305
318
Type: `bool` (default: `false`)
306
319
307
320
Turns the dropdown into a simple, single select dropdown. If you pass tree data, only immediate children are picked, grandchildren nodes are ignored. Defaults to `false`.
308
321
322
+
_NOTE_ if multiple nodes in data are selected, `checked` or `isDefaultValue`, only the first visited node is selected
323
+
324
+
### radioSelect
325
+
326
+
Type: `bool` (default: `false`)
327
+
328
+
Turns the dropdown into radio select dropdown. Similar to simpleSelect but keeps tree/children. Defaults to `false`.
329
+
330
+
_NOTE_ if multiple nodes in data are selected, `checked` or `isDefaultValue`, only the first visited node is selected
0 commit comments