LazyInit worked. Now there is a new issue: If i check some nodes in the server using the method Daniil suggested, only the nodes that are directly in the root get checked. The others only get checked after i have viewed the treepanel once.
Look at this example:
<%@ Page Language="C#" AutoEventWireup="true"%>
<%@ 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">
<script runat="server">
protected override void OnLoad(EventArgs e)
{
btDirectEvent.DirectEvents.Click.Event += new ComponentDirectEvent.DirectEventHandler(Click_Event);
base.OnLoad(e);
}
private void LoadStuff()
{
tpDashboard.ToggleCheck("600003_CON", true);
tpDashboard.ToggleCheck("600004_CON", true);
tpDashboard.ToggleCheck("600005_CON", true);
tpDashboard.ToggleCheck("600002_CON", true);
tpDashboard.ToggleCheck("600002_DFN", true);
tpDashboard.ToggleCheck("600002_DCL", true);
tpDashboard.ToggleCheck("600002_DEM", true);
tpDashboard.ToggleCheck("600002_DFO", true);
}
void Click_Event(object sender, DirectEventArgs e)
{
LoadStuff();
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<ext:Button runat="server" ID="btDirectEvent"></ext:Button>
<ext:ResourceManager ID="ResourceManager" runat="server" />
<ext:DropDownField ID="dfDashboard" runat="server" Editable="false" Width="300" TriggerIcon="SimpleArrowDown"
FieldLabel="Dashboard" LazyInit="false">
<Component>
<ext:TreePanel ID="tpDashboard" runat="server" Title="Itens Dashboard" Icon="Accept"
Height="220" Shadow="None" UseArrows="true" AutoScroll="true" Animate="true"
EnableDD="true" ContainerScroll="true" RootVisible="false">
<SelectionModel>
<ext:DefaultSelectionModel ID="DefaultSelectionModel1" runat="server"></ext:DefaultSelectionModel>
</SelectionModel>
<Root>
<ext:TreeNode>
<Nodes>
<ext:TreeNode NodeID="600003_CON" Text="Documentos" Icon="FolderTable" Checked="False"
Leaf="true" />
<ext:TreeNode NodeID="600004_CON" Text="Tarefas" Icon="ClockEdit" Checked="False"
Leaf="true" />
<ext:TreeNode NodeID="600005_CON" Text="Informações" Icon="Rss" Checked="False" Leaf="true" />
<ext:TreeNode NodeID="600002_CON" Text="Busca" Leaf="false" Icon="Zoom">
<Nodes>
<ext:TreeNode NodeID="600002_DFN" Text="Função" Leaf="true" Checked="False" />
<ext:TreeNode NodeID="600002_DCL" Text="Cliente" Leaf="true" Checked="False" />
<ext:TreeNode NodeID="600002_DEM" Text="Empresa" Leaf="true" Checked="False" />
<ext:TreeNode NodeID="600002_DFO" Text="Fornecedor" Leaf="true" Checked="False" />
</Nodes>
</ext:TreeNode>
</Nodes>
</ext:TreeNode>
</Root>
</ext:TreePanel>
</Component>
<Listeners>
<Expand Handler="this.component.getRootNode().expand(true);" Single="true" Delay="10" />
</Listeners>
</ext:DropDownField>
</div>
</form>
</body>
</html>
No mather how many times you click the button, the subnodes inside "Busca" (600002_CON) only get checked after you view the treepanel once.