Bug reports Found a bug? Post it here please.
Version 7.x > Bug reports > CMSListMenu ignores TopN View modes: 
User avatar
Member
Member
shauna.gordon-fahlgren - 12/12/2012 9:56:58 AM
   
CMSListMenu ignores TopN
I have the following CMSListMenu control:

<cms:CMSListMenu runat="server" ID="navLeft" ClassNames="*" Path="/{0}/{1}/%" DisplayOnlySelectedPath="True" TopN="3" />


The section it pulls from has 4 nodes that it can retrieve. Despite having TopN="3" (or any number less than 4), it displays all four nodes.

User avatar
Kentico Support
Kentico Support
kentico_janh - 12/12/2012 11:14:00 AM
   
RE:CMSListMenu ignores TopN
Hello,

Yes, this is a by design behavior and also the reason why is this property missing from the CSS list menu web part, because this property doesn't make sense for hierarchical structures and it could break them. If you want to display only one level structure in your navigation and render just some subset of items, you can take advantage of the Repeater web part where TopN property works as expected. Otherwise you would need to specify which items you want to render in your menu by using the WhereCondition property of the CMSListMenu control.

Best regards,
Jan Hermann

User avatar
Member
Member
shauna.gordon-fahlgren - 12/12/2012 2:08:27 PM
   
RE:CMSListMenu ignores TopN
kentico_janh wrote: ...the reason why is this property missing from the CSS list menu web part...


Then the documentation should indicate such. Even assuming the CMSListMenu user control isn't smart enough to indicate that in the incode documentation (the tooltips that Intellisense pops up) and so is stuck with whatever it can find, there is no indication in the documentation that it's not available for this control.

In fact, the documentation specifically states that it inherits all of the common properties from CMS - Common Controls.

kentico_janh wrote: ...because this property doesn't make sense for hierarchical structures and it could break them. If you want to display only one level structure in your navigation and render just some subset of items, you can take advantage of the Repeater web part where TopN property works as expected.


...Except CMSRepeaters are also hierachical. Why would it break CMSListMenu if it doesn't break CMSRepeater?

User avatar
Kentico Support
Kentico Support
kentico_janh - 12/13/2012 1:51:41 AM
   
RE:CMSListMenu ignores TopN
Hello,

Then the documentation should indicate such. Even assuming the CMSListMenu user control isn't smart enough to indicate that in the incode documentation (the tooltips that Intellisense pops up) and so is stuck with whatever it can find, there is no indication in the documentation that it's not available for this control.

In fact, the documentation specifically states that it inherits all of the common properties from CMS - Common Controls.


It should be mentioned in our documentation or at least the itellisense shouldn't offer it as a possible property. I am going to discuss this with our development department and I will let you know about their opinion on this.

...Except CMSRepeaters are also hierachical. Why would it break CMSListMenu if it doesn't break CMSRepeater?


Good point, however you can easily break the hierarchical structure in the repeater by setting appropriate combination of Order by expression and the TopN property, so you have to be careful when you are setting up the hierarchical repeater or the universal viewer web part.

Best regards,
Jan Hermann

User avatar
Member
Member
shauna.gordon-fahlgren - 12/13/2012 8:28:46 AM
   
RE:CMSListMenu ignores TopN
kentico_janh wrote:
It should be mentioned in our documentation or at least the itellisense shouldn't offer it as a possible property. I am going to discuss this with our development department and I will let you know about their opinion on this.

For the sake of being thorough, I'm using Visual Studio 2010 Professional. Both the base intellisense and intellisense augmented by ReSharper show TopN as a valid choice for CMSListMenu.

User avatar
Kentico Support
Kentico Support
kentico_janh - 12/13/2012 9:17:13 AM
   
RE:CMSListMenu ignores TopN
Hello,

I have consulted it with our development department and they will take a look at it. They told me they will probably remove the TopN property from the CMSListMenu control, because as I mentioned before, it doesn't make sense to cut hierarchical data to some value. Thank you for noticing!

Best regards,
Jan Hermann