I'm using the tree macro to generate a dynamic menu based on a page with JSON describing the menu. Everything worked perfectly in 16.2.0, but now the menus are no longer displayed and I get the following error in the console:
{code:java} jquery.min.js?r=1:2 jQuery.Deferred exception: f.forEach is not a function TypeError: f.forEach is not a function at Object.<anonymous> (https://xwiki.lan/xwiki/webjars/wiki%3Axwiki/xwiki-platform-tree-webjar/16.3.0/tree.min.js?r=1:2:146) at e (https://xwiki.lan/xwiki/webjars/wiki%3Axwiki/jquery/3.7.1/jquery.min.js?r=1:2:27028) at t (https://xwiki.lan/xwiki/webjars/wiki%3Axwiki/jquery/3.7.1/jquery.min.js?r=1:2:27330) undefined{code}
The menu is displayed in a panel using the following code:
{code:java} {{velocity}} {{context document="$services.model.serialize($doc.documentReference)" transformationContext="document"}} ## If a local _menu has been found, display the menu panel #if($!localMenu) #set($pageref = $doc.getFullName()) #set($json_ref = $!localMenu.replace(".WebHome", ".json")) #panelheader('Learning Path') {{tree reference="$json_ref" icons="false" edges="false" links="true" showRoot="false" openTo="$pageref" /}} #panelfooter() #end {{/context}} {{/velocity}}{code}
The variable *$json_ref* points to a page with the following JSON:
{code:java} {"id":"Sandbox.sequential-menu-test.WebHome","text":"Sequential Menu Test","a_attr":{"href":"\/xwiki\/bin\/view\/Sandbox\/sequential-menu-test\/"},"children":[{"id":"Sandbox.sequential-menu-test.page1.WebHome","text":"Page 1","a_attr":{"href":"\/xwiki\/bin\/view\/Sandbox\/sequential-menu-test\/page1\/"}},{"id":"Sandbox.sequential-menu-test.page2.WebHome","text":"Page 2","a_attr":{"href":"\/xwiki\/bin\/view\/Sandbox\/sequential-menu-test\/page2\/"}},{"id":"Sandbox.sequential-menu-test.page3.WebHome","text":"Page 3","a_attr":{"href":"\/xwiki\/bin\/view\/Sandbox\/sequential-menu-test\/page3\/"}},{"id":"Sandbox.sequential-menu-test.page4.WebHome","text":"Page 4","a_attr":{"href":"\/xwiki\/bin\/view\/Sandbox\/sequential-menu-test\/page4\/"}},{"id":"Sandbox.sequential-menu-test.page5.WebHome","text":"Page 5","a_attr":{"href":"\/xwiki\/bin\/view\/Sandbox\/sequential-menu-test\/page5\/"}}]}{code}
In 16.2.0, this displays a tree/menu as expected with the tree opened to the current page. In 16.3.0, nothing is displayed at all in the panel.
|
|