Bug reports Found a bug? Post it here please.
Version 6.x > Bug reports > CMSListMenu OrderBy NodeOrder Broken - v6.0.4350 View modes: 
User avatar
Member
Member
Luke - 12/2/2011 5:21:42 AM
   
CMSListMenu OrderBy NodeOrder Broken - v6.0.4350
I have noticed a major issue with ordering using CMSListMenu when trying to order by "NodeOrder" the CMSListMenu will only return second level items however doing the same with "NodeOrder DESC" works fine (but in reverse obviously).

To replicate:

<cms:CMSListMenu ID="menu" runat="server" ClassNames="CMS.MenuItem" OrderBy="NodeOrder" />


This breaks and will only show second level children.

<cms:CMSListMenu ID="menu" runat="server" ClassNames="CMS.MenuItem" OrderBy="NodeOrder DESC" />


This works and shows both parent and child nodes but in reverse obviously.

I have looked in SQL profiler and the generated SQL statement actually returns the correct nodes in the correct order on both occasions so the problem appears to be with the CMSListMenu itself.

Also changing CMSListMenu to a CMSMenu fixes the issue proving the problem lies with the control itself.

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 12/2/2011 7:58:51 AM
   
RE:CMSListMenu OrderBy NodeOrder Broken - v6.0.4350
Hello,

I've tried to reproduce the issue on my side on the same build, however my menu displays the same items just fine with the correct depth. You can try to debug it on your side. Aren't the items just hidden with some css? Please check the source code of your page. Additionally please try to run the site in debug mode and check what items are in the menu returned in the property DataSource which should contain the dataset with all the nodes which should be displayed. If the nodes aren't missing in this listing then this should be a problem with css or some other custom code, since the control returns the data correctly.

Best regards,
Boris Pocatko

User avatar
Member
Member
Luke - 12/2/2011 8:22:10 AM
   
RE:CMSListMenu OrderBy NodeOrder Broken - v6.0.4350
Hi Boris,

This is literally a brand new website with no css or anything going on as we are in very initial stages of build. The sql statement returned in debug results in the following:

SELECT ClassName, DocumentCulture, DocumentModifiedWhen, DocumentMenuCaption, DocumentMenuClass, DocumentMenuClassHighLighted, DocumentMenuClassOver, DocumentShowInSiteMap, DocumentMenuItemHideInNavigation, DocumentMenuItemImage, DocumentMenuItemImageHighlighted, DocumentMenuItemImageOver, DocumentMenuItemInactive, DocumentMenuItemLeftImage, DocumentMenuItemLeftImageHighlighted, DocumentMenuItemLeftImageOver, DocumentMenuItemRightImage, DocumentMenuItemRightImageHighlighted, DocumentMenuItemRightImageOver, DocumentMenuJavascript, DocumentMenuRedirectUrl, DocumentMenuStyle, DocumentMenuStyleHighlighted, DocumentMenuStyleOver, DocumentName, DocumentUrlPath, NodeAliasPath, NodeID, NodeChildNodesCount, NodeClassID, NodeLevel, NodeLinkedNodeID, NodeParentID, SiteName, NodeACLID, NodeSiteID, NodeOwner, NodeXML FROM View_CMS_Tree_Joined_Versions INNER JOIN CONTENT_MenuItem ON View_CMS_Tree_Joined_Versions.DocumentForeignKeyValue = CONTENT_MenuItem.[MenuItemID] WHERE (((NodeSiteID = 1) AND (DocumentCulture = N'en-GB')) AND (NodeLevel <= 2)) AND (ClassName = 'CMS.MenuItem') ORDER BY NodeOrder


This when run in SQL management studio returns the correct nodes and levels etc so I can only assume something goes on in CMSListMenu code somewhere which results in the behaviour described above?

Many Thanks,
Luke

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 12/2/2011 9:35:08 AM
   
RE:CMSListMenu OrderBy NodeOrder Broken - v6.0.4350
Hello,

This query seems to be already selecting only two levels of documents (NodeLevel <= 2). Could you please set up a page with two menus set up differently according to your description and post a link to it?

Best regards,
Boris Pocatko

User avatar
Member
Member
Luke - 12/6/2011 4:27:14 AM
   
RE:CMSListMenu OrderBy NodeOrder Broken - v6.0.4350
Hi Boris,

I believe the issue is in fact due to when you set MaxRelativeLevel to be greater than 1 or to the wildcard of -1.

Therefore to clarify the issue occurs when ordering by NodeOrder ASCENDING and when you specify a MaxRelativeLevel greater than 1 or a MaxRelativeLevel of -1.

This is becoming quite a problem for us, please could you confirm if this issue is in fact a bug and if so when a Hotfix will be published?

Many Thanks,
Luke

User avatar
Member
Member
Luke - 12/6/2011 4:29:36 AM
   
RE:CMSListMenu OrderBy NodeOrder Broken - v6.0.4350
If it helps the exact code we are trying to use is:

<cms:cmslistmenu runat="server" ID="menu" Path="/%" CheckPermissions="true" ClassNames="CMS.MenuItem" MaxRelativeLevel="2" DisplayHighlightedItemAsLink="true" OrderBy="NodeOrder" />

User avatar
Member
Member
Luke - 12/6/2011 4:33:57 AM
   
RE:CMSListMenu OrderBy NodeOrder Broken - v6.0.4350
Ahh we have just found a workaround if you specify OrderBy="NodeLevel, NodeOrder" the control then works correctly so there is definitely something strange going on that means you can't just specify OrderBy="NodeOrder" when you are requesting more than one level of documents.

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 12/6/2011 6:08:38 AM
   
RE:CMSListMenu OrderBy NodeOrder Broken - v6.0.4350
Hello,

Regrettably, I wasn't able to reproduce this issue on my side. Your definition of the menu has the MaxRelativeLevel set to 2 so that's why only 2 levels are displayed. I tried your code snippet on my side with both, the MaxRelativeLevel set to 2 and -1 and both settings work as expected.

Best regards,
Boris Pocatko

User avatar
Member
Member
brandonm-salespad - 4/26/2012 10:43:00 AM
   
CMSListMenu Limited to 2 Layers
I'm not 100% that this is the same root issue, but I stumbled upon this thread while trying to figure out why my CMSListMenu would only display 2 levels. If I added another ClassName to get another layer to show up, it would remove a layer at the top to make room leaving me with a maximum of 2 layers.

Example:
(Layer 1)
(Layer 2)
(Layer 2)

adding another class that I knew was below layer 2 would make it...

(Layer 2)
(Layer 3)
(Layer 3)
(Layer 2)
(Layer 3)


My fix for this turned out to be that I had to remove OrderBy="NodeOrder" and magically I can get 3 layers.

User avatar
Kentico Support
Kentico Support
kentico_janh - 4/30/2012 1:24:45 AM
   
RE:CMSListMenu Limited to 2 Layers
Hello,

May I ask you, what document types do you have listed in your content tree? Could you please post a tree structure of your site with document types you use (or a screenshot) and also an export of your menu settings (menu properties -> link at the bottom)?

Best regards,
Jan Hermann