I am trying to set up a client (or server) side expand/collapse settings for the tree view on File Explorer. Everything is working for the collapse, but my expand code is still having issues.
I tried first on the server side with 'fileExplorer.TreeView.ExpandAllNodes()', but during Page_Load the TreeView is null.
I then switched to trying on the client side. I was able to get the first level of nodes to expand, but then the ajax call prevented further expanding.
Here's my js code which expands the first level:
Since the client isn't aware of the subfolders until the ajax call returns, nodeExpandCollapse does not recurse. After I load all the folders using ajax, the collapse and expand buttons work correctly.
I thought that by attaching to the OnClientNodePopulated event of the treeview, I could determine that a node has been populated and then run it through the expander, but this event (using tree.add_nodePopulated()) does not fire at all when the tree is expanded, even doing a manual expand. My first thought is that the FileExplorer tie in is blocking my tie in (if I check get_events(), it shows two handlers for OnClientNodePopulated) but if anyone has any ideas it would be much appreciated.
I tried first on the server side with 'fileExplorer.TreeView.ExpandAllNodes()', but during Page_Load the TreeView is null.
I then switched to trying on the client side. I was able to get the first level of nodes to expand, but then the ajax call prevented further expanding.
Here's my js code which expands the first level:
function
treeExpandCollapse(t, b) {
var
nodes = t.get_allNodes();
for
(
var
i = 0; i < nodes.length; i++) {
nodeExpandCollapse(nodes[i], b);
}
}
function
nodeExpandCollapse(n, b) {
var
nodes = n.get_allNodes();
for
(
var
i = 0; i < nodes.length; i++) {
if
(b) nodes[i].expand();
else
nodes[i].collapse();
//nodes[i].set_expanded(b);
// Recurse
nodeExpandCollapse(nodes[i]);
}
}
Since the client isn't aware of the subfolders until the ajax call returns, nodeExpandCollapse does not recurse. After I load all the folders using ajax, the collapse and expand buttons work correctly.
I thought that by attaching to the OnClientNodePopulated event of the treeview, I could determine that a node has been populated and then run it through the expander, but this event (using tree.add_nodePopulated()) does not fire at all when the tree is expanded, even doing a manual expand. My first thought is that the FileExplorer tie in is blocking my tie in (if I check get_events(), it shows two handlers for OnClientNodePopulated) but if anyone has any ideas it would be much appreciated.