Tomasz Sikora
Tomasz Sikora

Reputation: 1767

Kentico: How to get children for selected parent page (in page selector) into uni selector?

I have a widget configuration with following setup in properties: enter image description here When user selects Page through page selector and now wants to select Tiles, I want to display all children of the Page in selection grid for Uni Selector. How can I achieve that?

I was trying to add some "where" condition but with no luck so far.

Upvotes: 0

Views: 821

Answers (1)

Trevor F
Trevor F

Reputation: 1437

You usually can access another field via the macros {% Page.Value %} or if that doesn't work, then {% Fields["Page"].Value %}

Try those first, depending on what the Page returns (usually a page selector returns the GUID, so your where condition would have to be based on that).

Another note is that the object type CMS.document MAY not include the CMS_Tree data along with it. It is not recommended you select documents anyway because of things like work flows, where as selecting a Tree Node is safer because there is only 1 "Node" where there can be many Documents (language variants).

If you switch your Tiles to be Node, then the where would be:

 NodeParentID = (Select top 1 NodeID from CMS_Tree where NodeGUID = '{% Page.Value %}')

If you need to keep it Document instead, then you would want

DocumentNodeID in (SELECT NodeID FROM CMS_Tree where NodeParentID = (Select top 1 NodeID from CMS_Tree where NodeGUID = '{% Page.Value %}'))

Lastly, if you are trying to create a many-to-many relationship, i'm finishing up right now a Many-To-Many selector tool so you can utilize Custom Binding Classes. If you want it early, shoot me a message @ devtrev.com

Upvotes: 1

Related Questions