Skip to content

Commit 3c774fd

Browse files
committed
Add a feature to disable a node.
1 parent bc59551 commit 3c774fd

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,4 @@ Individual nodes within the `nodes` property can have the following structure:
115115
| `children` | array | An array of child nodes. |
116116
| `className` | string | A className to add to the node. |
117117
| `icon` | mixed | A custom icon for the node. |
118+
| `disabled` | bool | Disable node. |

src/js/CheckboxTree.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,14 @@ class CheckboxTree extends React.Component {
191191
const checked = this.getCheckState(node, noCascade);
192192
const children = this.renderChildNodes(node);
193193

194+
const nodeDisabled = !!(disabled || node.disabled);
195+
194196
return (
195197
<TreeNode
196198
key={key}
197199
checked={checked}
198200
className={node.className}
199-
disabled={disabled}
201+
disabled={nodeDisabled}
200202
expandDisabled={expandDisabled}
201203
expanded={node.expanded}
202204
icon={node.icon}

src/js/TreeNode.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ class TreeNode extends React.Component {
145145
'rct-node': true,
146146
'rct-node-parent': this.hasChildren(),
147147
'rct-node-leaf': !this.hasChildren(),
148+
'rct-disabled': disabled,
148149
}, className);
149150

150151
return (

0 commit comments

Comments
 (0)