Hierarchal Viewer Question

lawrence whittemore asked on August 4, 2016 19:55

I am working on a document listing control that shows documents in an accordion type structure that allows users to set any level of folders and documents they need they need for the documents. I have 3 document types set up for the control and use the hierarcal viewer to show them. Everything works great except the documents show on all root pages and not just the page I need them to show on.

Example structure.

Root Page
- Second level Page
--Documents Group
---Documents folder
----file
----file
----file
---Documents Folder
----Documents folder
-----file
-----file
----documents folder
-----file

What I need is the viewer to only show on the second level page and not the root page in this example. What it essentially needs is to only show on a page that the document group is listed directly below.

Hope this makes sense.

Recent Answers


Chetan Sharma answered on August 4, 2016 20:02

You can define the "Show for page types" settings in the hierarchical viewer and check the page type on which you would like it to show. Otherwise it will show by default on the level where the web part is.

Thanks, Chetan

0 votesVote for this answer Mark as a Correct answer

Joshua Adams answered on August 4, 2016 20:10 (last edited on December 10, 2019 02:30)

Chetans suggestion should work if they are different page types. If not, seems like you may need a macro visibility condition maybe similar to this:

{% CurrentDocument.NodeLevel >=2 |(identity)GlobalAdministrator%}

You may need to change that to 1, depending on your structure, but should be easy enough to change and test.

0 votesVote for this answer Mark as a Correct answer

lawrence whittemore answered on August 4, 2016 20:32

is there a macro that we could write that would check if the current document has a child that is of a specific document type?

0 votesVote for this answer Mark as a Correct answer

lawrence whittemore answered on August 4, 2016 20:36

I don't want to limit it by node level, that was just my example. It would need to work if the structure looked like this as well

page
-page
--page
---page 2
----document group 1
-----yada yada
--page
-page 3
--document group 2

So document group 2 should only show on page 3 and document group 1 on shows on page 2...

0 votesVote for this answer Mark as a Correct answer

Joshua Adams answered on August 4, 2016 20:54

Seems like if its going to be that complex it may be easier to add a field to the document type that you want it to show on as a boolean and control it based on that field.

0 votesVote for this answer Mark as a Correct answer

Jan Hermann answered on August 5, 2016 13:56 (last edited on December 10, 2019 02:30)

is there a macro that we could write that would check if the current document has a child that is of a specific document type?

Sure there is one. You can do practically anything using macros:

{%CurrentDocument.Children.Where("ClassName='specific.pagetype'").Count>0|(identity)GlobalAdministrator%}

1 votesVote for this answer Mark as a Correct answer

Chetan Sharma answered on August 5, 2016 19:16 (last edited on December 10, 2019 02:30)

If that's a case Lawerence then you may use like this.

{% CMSContext.CurrentDocument.NodeHasChildren && CMSContext.CurrentDocument.DocumentType=="pm.Home" |(identity)GlobalAdministrator%}

Where "pm.Home" is classname for my page type.

Cheers Chetan

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.