My understanding is that the PageTree expands to show the children around the CurrentPage. ExpandAll will make everything expanding obvious. If you do ShowRootPage, then it would also expand everything, since you are, by definition, in a child of the root page (any page is a child of the root page).
Exactly what do you want expanded, and what do you want collapsed?
I expected the following:
take this page structure:
StartPage
- SubPage 1
- SubSubPage 1.1
- SubSubPage 1.2
- SubPage 2
- SubPage 3
.....I would expect my menu to render like:
- SubPage 1
- SubPage 2
- SubPage 3
when ShowRootPage = false. What I get is ...nothing... unless I do an ExpandAll = true; - but as you say, then all nodes on all levels show up.
- Am I missing something obvious ?
Not to answer your question with another question, but why use the PageTree property then? Why not just use MenuList? You essentially want the top-level nodes, right? The direct children of Start Page? There are easier ways to get that.
Well, I want a flat list of first-level pages when opening the root page for the first time (which isn't really the start page, it's a subpage). Then it will expand as the user clicks his way down the hierarchy.
Everything works as expected part from I can't get the root page not to display on top of the list. That was what I expected the ShowRootPage is meant for. It now hides both the root page and the child pages (leaving it empty).
Then it will expand as the user clicks his way down the hierarchy.
Expand as the user clicks from page to page, or expand dynamically in the client?
I did some testing. My Start Page is Page ID #3.
With this:
<EPiServer:PageTree runat="server" ShowRootPage="false" ExpandAll="false" PageLink="3">
I get:
With this:
<EPiServer:PageTree runat="server" ShowRootPage="false" ExpandAll="true" PageLink="3">
I get:
etc.
In neither case is the root page shown.
Is this not what you're getting?
"In neither case is the root page shown.
Is this not what you're getting?"
No, and that's my frustration. If your hidden start page is named "StartPage" then I get:
...when ShowRootPage = true, and
(nothing visible)
...when ShowRootPage = false.
How come ?
I'm sorry, but I don't know. This is the not the behavior I'm seeing.
I used the code above with the default Public Templates demo site. Here's the entire code section:
<EPiServer:PageTree runat="server" ShowRootPage="false" ExpandAll="true" PageLink="3">
<IndentTemplate>
<ul>
</IndentTemplate>
<UnindentTemplate>
</ul>
</UnindentTemplate>
<ItemTemplate>
<li><EPiServer:Property PropertyName="PageName" runat="server"/></li>
</ItemTemplate>
</EPiServer:PageTree>
I am kind of embarassed - as the reason was the PageTree had no TopTemplate.
This way, only the expanded page (on the level below the root) would display. The site has this kind of linking main menu and submenu where only the selected item in the main menu (a "4x4" items list / "table") is displayed in the submenu. (http://kreftregisteret.no)
Well, anyway, I didn't see that one until today.
Thanks for trying to help !
...unless I do an ExpandAll = true;
The PageTree is a submenu. When ShowRootPage = true, root page and all its children are displayed, when false then - nothing.
Any simple solutions ?