In your examples you can get a direct link to the page Like this:
https://examples1.ext.net/#/Desktop/...tion/Overview/
Is there a way to refresh the treepanel with this link so the entire path is shown (expanded)?
Printable View
In your examples you can get a direct link to the page Like this:
https://examples1.ext.net/#/Desktop/...tion/Overview/
Is there a way to refresh the treepanel with this link so the entire path is shown (expanded)?
Hi,
Please see Ext.Net Examples Explorer (in the SVN). It expands tree node if you use direct link (see main.js)
You have to map link to the node id (we use hash code of the link as tree node id), after that find node by id (use getNodeById method of the tree, please ensure that all nodes are loaded already (you can use load listener of the tree) ) and call ensureVisible method of the tree node
I'm using Async loader in .82. I can find the root node with getNodeById, but not any of the children. How can I find the children?
Hi,
If you use async loader to load children for each node then you cannot find nodes until parent node loads own children.
You have to manually expand all parent nodes first (expand first parent node, in the callback expand next node and etc)
Code:node1.expand(false, false, function(){node2.expand(...);})
Or load all nodes at once
Hi Vladsch
Here is the code I'm using to expand the nodes:
It seems to find the root, but not the child. Am I calling this function correctly?Code:
TreePanel1_1.AddScript("TreePanel1_1.getNodeById('AAA_ROOT').expand(false,false,function() {TreePanel1_1.getNodeById('PUB_0001').expand(false,false)});")
Hi,
Please see the following sample
Code:<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>TreePanel with Async TreeLoader using Page - Ext.NET Examples</title>
<link href="../../../../resources/css/examples.css" rel="stylesheet" type="text/css" />
<script runat="server">
protected void NodeLoad(object sender, NodeLoadEventArgs e)
{
string prefix = e.ExtraParams["prefix"] ?? "";
if (!string.IsNullOrEmpty(e.NodeID))
{
for (int i = 1; i < 6; i++)
{
AsyncTreeNode asyncNode = new AsyncTreeNode();
asyncNode.Text = prefix + e.NodeID + i;
asyncNode.NodeID = e.NodeID + i;
e.Nodes.Add(asyncNode);
}
for (int i = 6; i < 11; i++)
{
Ext.Net.TreeNode treeNode = new Ext.Net.TreeNode();
treeNode.Text = prefix + e.NodeID + i;
treeNode.NodeID = e.NodeID + i;
treeNode.Leaf = true;
e.Nodes.Add(treeNode);
}
}
}
</script>
<script type="text/javascript">
function openNode(ids, i){
i = i || 0;
if(ids.length == (i+1)){
var node = TreePanel1.getNodeById(ids[i]);
node.ensureVisible();
node.select();
}
else{
TreePanel1.getNodeById(ids[i]).expand(false, false, openNode.createDelegate(this, [ids, ++i]));
}
}
</script>
</head>
<body>
<form runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<h1>TreePanel using PageTreeLoader</h1>
<p>Set custom node prefix: </p>
<ext:TextField ID="TextField1" runat="server" Text="Node" />
<ext:TreePanel
ID="TreePanel1"
runat="server"
Title="Tree"
AutoHeight="true"
Border="false">
<Loader>
<ext:PageTreeLoader OnNodeLoad="NodeLoad">
<BaseParams>
<ext:Parameter Name="prefix" Value="#{TextField1}.getValue()" Mode="Raw" />
</BaseParams>
</ext:PageTreeLoader>
</Loader>
<Root>
<ext:AsyncTreeNode NodeID="0" Text="Root" />
</Root>
</ext:TreePanel>
<ext:Button runat="server" Text="Open Node01349">
<Listeners>
<Click Handler="openNode(['0', '01', '013', '0134', '01349'])" />
</Listeners>
</ext:Button>
</form>
</body>
</html>
Hi Vladsch
Everything works good except that I had to modify the js code to make a call to load the iframe. See code below. The problem is when I call openNode the first time it opens the nodes but does not select the leaf and does not execute the callback. When I click the button again, it selects the leaf and makes the callback. I'm assuming this worked because the nodes were already expanded. Any ideas?
Is there a delay issue here?
Code:
function openNode(ids, i) {
i = i || 0;
if (ids.length == (i + 1)) {
var node = TreePanel1_1.getNodeById(ids[i]);
node.ensureVisible();
node.select();
Coolite.AjaxMethods.TreePanel_ClickJS(ids[i]);
} else {
TreePanel1_1.getNodeById(ids[i]).expand(false, false,
openNode.createDelegate(this, [ids, ++i]));
}
}
Hi,
Can you post full example which demonstrates your last issue?
Here is the code starting with the button. Node PUB_0050 is a leaf node tied to a table record with a URL
Then we have the Javascript code to expand the nodes. A call is made to Coolite.AjaxMethods.TreePanel_ClickJS to get the URL.Code:
<ext:Toolbar ID="ToolBar2" runat="server">
<Items>
<ext:Button ID="Button1" runat="server" Text="Open Node01349">
<Listeners>
<Click Handler="openNode(['AAA_ROOT','PUB_0004','PUB_0050'])" />
</Listeners>
</ext:Button>
</Items>
</ext:Toolbar>
Here is the AjaxMethod to load the iframe witht he URLCode:
function openNode(ids, i) {
i = i || 0;
if (ids.length == (i + 1)) {
Coolite.AjaxMethods.TreePanel_ClickJS(ids[i]);
var node = TreePanel1_1.getNodeById(ids[i]);
node.ensureVisible();
node.select();
} else {
TreePanel1_1.getNodeById(ids[i]).expand(false, false,
openNode.createDelegate(this, [ids, ++i]));
}
}
If I click the button once, it does expand the tree out as intented, but does not load the iframe with the URL. If I click the button a second time, it loads the URL into the iframe like I need it to do the first time I click the button.Code:
<AjaxMethod()> _
Public Sub TreePanel_ClickJS(ByVal NodeId As String)
Dim NavigateURL As String = "/Common/Pages/WebUnderConstruction.aspx"
Dim bo As New DCPMenus(DCPUtil_ConfigSettingsWeb.DBConnection)
bo.NodeID = NodeId
bo.WhereFilter = DCPMenusDC.WhereFilters.NodeID
bo.Open(True)
If String.IsNullOrEmpty(bo.NavigateUrl) Then
Pages.AutoLoad.Url = NavigateURL
Else
Pages.AutoLoad.Url = bo.NavigateUrl
End If
Pages.AutoLoad.Mode = LoadMode.IFrame
Pages.AutoLoad.NoCache = True
Pages.LoadContent()
End Sub
Hi,
We need full sample. Can you modify my sample to demonstrate the problem?
Also you can try to set selection in 'ensureVisible' callback
Code:node.ensureVisible(function(){node.select();});