Split items in 2 columns in hierarchical viewer

Liz B asked on November 1, 2018 00:26

I'm using the hierarchical viewer for my top navigation. My navigation has a mega menu and will show you its content split into columns when you hover over it. I want to split the child navigation into 2 columns depending on how many children exist. If for example, more than 4 child pages exist than I want it split into 2 columns or 2 separate lists(uls). I've been researching how to do this and I can't seem to find a good example. I'm using text/xml view for my transformation. Can anyone point me in the right direction?

Thanks

Correct Answer

David te Kloese answered on November 1, 2018 11:40

Most of it should be doable via Frontend, but if you want to help a bit you can check the DataItemIndex which basically returns a count for which row you are. Using modulo calculation you can check if it's a 4th item..

so add at the end of the transofrmation something like

{% if (DataItemIndex mod 4 == 0) {"</div>"} else {"<br />"} |(identity)GlobalAdministrator%}

or add a special class to each 5th row or what ever you need.

1 votesVote for this answer Unmark Correct answer

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