Hello experts,
NW 7.4 Portal
I am trying to get the full navigation tree for a logged user so i can create a mega-menu.
Currently using this but only gets down to level 2
eg
My Work
--> System Admin
---> S 1
---> S2
Will only retrieve My Work & System Admin, and not any other levels below this
LSAPI.AFPPlugin.model.getNavigationSubTree(null, _parseNavigationNodes); |
var _parseNavigationNodes = function(nodes, args)
{
if (!nodes) return;
for (var i = 0; i < nodes.length; i++)
{
var node, title, nodeUri, hasChildren;
node = nodes[i];
nodeUri = node.getNodeURI();
hasChildren = node.hasChildren();
title = node.getTitle();
console.log("Found Node --> " + title);
// if the node has children, perform recursive call
if (hasChildren)
{
console.log(title + " Has Child Nodes -->");
node.getChildren(_parseNavigationNodes);
}
}
}
Any ideas why lower levels are not retreived. I have noticed errors in browser console..
Found Node --> System Administration afpmasthead.js?4c769db5aeafef8971c63348e2b6504d:963
System Administration Has Child Nodes --> afpmasthead.js?4c769db5aeafef8971c63348e2b6504d:967
Refused to set unsafe header "Content-length" core_navigation.js?54764b0de3ee371dbf996d4134af4243:1AFPConnection.request core_navigation.js?54764b0de3ee371dbf996d4134af4243:1AFPConnection.requestIfUpdated core_navigation.js?54764b0de3ee371dbf996d4134af4243:1LSAPI.AFPPlugin.model.b core_navigation.js?54764b0de3ee371dbf996d4134af4243:1LSAPI.AFPPlugin.model.H core_navigation.js?54764b0de3ee371dbf996d4134af4243:1getChildren core_navigation.js?54764b0de3ee371dbf996d4134af4243:1_parseNavigationNodes afpmasthead.js?4c769db5aeafef8971c63348e2b6504d:968getChildren core_navigation.js?54764b0de3ee371dbf996d4134af4243:1_parseNavigationNodes afpmasthead.js?4c769db5aeafef8971c63348e2b6504d:968LSAPI.AFPPlugin.model.w core_navigation.js?54764b0de3ee371dbf996d4134af4243:1AFPConnection.handleResponse core_navigation.js?54764b0de3ee371dbf996d4134af4243:1(anonymous function)