How do I get all Ant Design TreeNodes to be disabled if they don't have children in React.js? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!How to disable modal mask background in Ant Designant design recursive nested table don't workHow to disable button in Ant Design Input.Search componentHow to use ant design in server side rendering?How to right-align menu items in Ant Design?Ant Design range picker disable array of datesHow to make TreeNode in Ant tree design as link?Ant Design: How to pass this.props.form to childrenSelect ant design react component disable text inputAnt Design Select with option group doesn't show groups with out children
Assertions In A Mock Callout Test
What's the connection between Mr. Nancy and fried chicken?
Putting Ant-Man on house arrest
Does Prince Arnaud cause someone holding the Princess to lose?
What documents does someone with a long-term visa need to travel to another Schengen country?
Trying to enter the Fox's den
What were wait-states, and why was it only an issue for PCs?
Why "Go Out and Learn"
Why do C and C++ allow the expression (int) + 4*5?
Is Bran literally the world's memory?
How is an IPA symbol that lacks a name (e.g. ɲ) called?
Should man-made satellites feature an intelligent inverted "cow catcher"?
Why did Europeans not widely domesticate foxes?
reduction from 3-SAT to Subset Sum problem
Is "ein Herz wie das meine" an antiquated or colloquial use of the possesive pronoun?
What is the definining line between a helicopter and a drone a person can ride in?
Why are two-digit numbers in Jonathan Swift's "Gulliver's Travels" (1726) written in "German style"?
Is it OK if I do not take the receipt in Germany?
/bin/ls sorts differently than just ls
Who can become a wight?
IC on Digikey is 5x more expensive than board containing same IC on Alibaba: How?
Why aren't these two solutions equivalent? Combinatorics problem
Can a Knight grant Knighthood to another?
Does traveling In The United States require a passport or can I use my green card if not a US citizen?
How do I get all Ant Design TreeNodes to be disabled if they don't have children in React.js?
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!How to disable modal mask background in Ant Designant design recursive nested table don't workHow to disable button in Ant Design Input.Search componentHow to use ant design in server side rendering?How to right-align menu items in Ant Design?Ant Design range picker disable array of datesHow to make TreeNode in Ant tree design as link?Ant Design: How to pass this.props.form to childrenSelect ant design react component disable text inputAnt Design Select with option group doesn't show groups with out children
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
So I have this renderTreeNodes function...and disabled is bound to this.state.isTreeDisabled, however only tree nodes which have children will become disabled for the duration of the AJAX operation. I'll attach a screen shot below the code. If anyone knows how to address this, I'd appreciate it.
renderTreeNodes(data)
if(data === undefined) return [];
return data.map(item =>
if (item.children)
return (
<TreeNode title=item.title key=item.key
dataRef=item disabled=this.state.isTreeDisabled
>
this.renderTreeNodes(item.children)
</TreeNode>
);
return (<TreeNode ...item dataRef=item />);
);
As you can see...they are all TreeNode objects...but for whatever reason...only the 2 which have children are grayed out.

reactjs antd
add a comment |
So I have this renderTreeNodes function...and disabled is bound to this.state.isTreeDisabled, however only tree nodes which have children will become disabled for the duration of the AJAX operation. I'll attach a screen shot below the code. If anyone knows how to address this, I'd appreciate it.
renderTreeNodes(data)
if(data === undefined) return [];
return data.map(item =>
if (item.children)
return (
<TreeNode title=item.title key=item.key
dataRef=item disabled=this.state.isTreeDisabled
>
this.renderTreeNodes(item.children)
</TreeNode>
);
return (<TreeNode ...item dataRef=item />);
);
As you can see...they are all TreeNode objects...but for whatever reason...only the 2 which have children are grayed out.

reactjs antd
add a comment |
So I have this renderTreeNodes function...and disabled is bound to this.state.isTreeDisabled, however only tree nodes which have children will become disabled for the duration of the AJAX operation. I'll attach a screen shot below the code. If anyone knows how to address this, I'd appreciate it.
renderTreeNodes(data)
if(data === undefined) return [];
return data.map(item =>
if (item.children)
return (
<TreeNode title=item.title key=item.key
dataRef=item disabled=this.state.isTreeDisabled
>
this.renderTreeNodes(item.children)
</TreeNode>
);
return (<TreeNode ...item dataRef=item />);
);
As you can see...they are all TreeNode objects...but for whatever reason...only the 2 which have children are grayed out.

reactjs antd
So I have this renderTreeNodes function...and disabled is bound to this.state.isTreeDisabled, however only tree nodes which have children will become disabled for the duration of the AJAX operation. I'll attach a screen shot below the code. If anyone knows how to address this, I'd appreciate it.
renderTreeNodes(data)
if(data === undefined) return [];
return data.map(item =>
if (item.children)
return (
<TreeNode title=item.title key=item.key
dataRef=item disabled=this.state.isTreeDisabled
>
this.renderTreeNodes(item.children)
</TreeNode>
);
return (<TreeNode ...item dataRef=item />);
);
As you can see...they are all TreeNode objects...but for whatever reason...only the 2 which have children are grayed out.

reactjs antd
reactjs antd
asked Mar 9 at 2:22
steviesamasteviesama
147210
147210
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Sorry guys...I'd been staring at too much of the other code for too long...I completely missed the non children TreeNode part at the bottom...I just added the disable=this.state.isTreeDisabled to it and blam...works
renderTreeNodes(data)
if(data === undefined) return [];
return data.map(item =>
if (item.children)
return (
<TreeNode title=item.title key=item.key
dataRef=item disabled=this.state.isTreeDisabled
>
this.renderTreeNodes(item.children)
</TreeNode>
);
// sigh...I didn't notice this bottom TreeNode in the recursive structure...
return (<TreeNode ...item dataRef=item disabled=this.state.isTreeDisabled/>);
);

add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55073400%2fhow-do-i-get-all-ant-design-treenodes-to-be-disabled-if-they-dont-have-children%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sorry guys...I'd been staring at too much of the other code for too long...I completely missed the non children TreeNode part at the bottom...I just added the disable=this.state.isTreeDisabled to it and blam...works
renderTreeNodes(data)
if(data === undefined) return [];
return data.map(item =>
if (item.children)
return (
<TreeNode title=item.title key=item.key
dataRef=item disabled=this.state.isTreeDisabled
>
this.renderTreeNodes(item.children)
</TreeNode>
);
// sigh...I didn't notice this bottom TreeNode in the recursive structure...
return (<TreeNode ...item dataRef=item disabled=this.state.isTreeDisabled/>);
);

add a comment |
Sorry guys...I'd been staring at too much of the other code for too long...I completely missed the non children TreeNode part at the bottom...I just added the disable=this.state.isTreeDisabled to it and blam...works
renderTreeNodes(data)
if(data === undefined) return [];
return data.map(item =>
if (item.children)
return (
<TreeNode title=item.title key=item.key
dataRef=item disabled=this.state.isTreeDisabled
>
this.renderTreeNodes(item.children)
</TreeNode>
);
// sigh...I didn't notice this bottom TreeNode in the recursive structure...
return (<TreeNode ...item dataRef=item disabled=this.state.isTreeDisabled/>);
);

add a comment |
Sorry guys...I'd been staring at too much of the other code for too long...I completely missed the non children TreeNode part at the bottom...I just added the disable=this.state.isTreeDisabled to it and blam...works
renderTreeNodes(data)
if(data === undefined) return [];
return data.map(item =>
if (item.children)
return (
<TreeNode title=item.title key=item.key
dataRef=item disabled=this.state.isTreeDisabled
>
this.renderTreeNodes(item.children)
</TreeNode>
);
// sigh...I didn't notice this bottom TreeNode in the recursive structure...
return (<TreeNode ...item dataRef=item disabled=this.state.isTreeDisabled/>);
);

Sorry guys...I'd been staring at too much of the other code for too long...I completely missed the non children TreeNode part at the bottom...I just added the disable=this.state.isTreeDisabled to it and blam...works
renderTreeNodes(data)
if(data === undefined) return [];
return data.map(item =>
if (item.children)
return (
<TreeNode title=item.title key=item.key
dataRef=item disabled=this.state.isTreeDisabled
>
this.renderTreeNodes(item.children)
</TreeNode>
);
// sigh...I didn't notice this bottom TreeNode in the recursive structure...
return (<TreeNode ...item dataRef=item disabled=this.state.isTreeDisabled/>);
);

answered Mar 9 at 2:33
steviesamasteviesama
147210
147210
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55073400%2fhow-do-i-get-all-ant-design-treenodes-to-be-disabled-if-they-dont-have-children%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown