Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi guys,
I have following structure of my content:
Homepage
Debates (doc type "Debates")
Debate1 (doc type "Debate")
Debate2 (doc type "Debate")
So when I try to get nodes of type "Debate" from Homepage like this it doesn't work:
List<Node> allDebates = node.GetDescendantNodesByType("Debate").ToList();
But if I do it this way it works:
Node debatesNode = node.GetChildNodesByType("Debates").FirstOrDefault();List<Node> allDebates = debatesNode.GetDescendantNodesByType("Debate").ToList();
It looks like GetDescendantNodesByType() can only get direct children and works exactly like GetChildNodesByType().
Is it a bug of uQuery, or am I doing something wrong?
Hi Zakhar,
Just had a look at the source-code... think it might be a bug with that method (I'll need to test further to verify that though).
As a workaround, you could try this:
var allDebates = node.GetDescendantNodes().Where(x => x.NodeTypeAlias == "Debate");
Cheers, Lee.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
uQuery GetDescendantNodesByType() doesn't work as it should
Hi guys,
I have following structure of my content:
Homepage
Debates (doc type "Debates")
Debate1 (doc type "Debate")
Debate2 (doc type "Debate")
So when I try to get nodes of type "Debate" from Homepage like this it doesn't work:
List<Node> allDebates = node.GetDescendantNodesByType("Debate").ToList();
But if I do it this way it works:
Node debatesNode = node.GetChildNodesByType("Debates").FirstOrDefault();
List<Node> allDebates = debatesNode.GetDescendantNodesByType("Debate").ToList();
It looks like GetDescendantNodesByType() can only get direct children and works exactly like GetChildNodesByType().
Is it a bug of uQuery, or am I doing something wrong?
Hi Zakhar,
Just had a look at the source-code... think it might be a bug with that method (I'll need to test further to verify that though).
As a workaround, you could try this:
Cheers, Lee.
is working on a reply...