PDA

View Full Version : [CLOSED] TreePanel CheckNodes Null when checking them from codebehind



gs_user
Jun 24, 2012, 2:46 PM
Hi,

I create a treepanel codebehind and select data from db
If the node equal db data, I set checked to be true
The nodes are perfectly checked on screen when necessary.
When saving the form again without changing the checklist, the following code CheckedNodes was null
The nodes checked on screen was correct, why the CheckedNodes was null????



if (this.mytree.CheckedNodes != null) --> checknodes was always null,even the nodes on screen was checked
{

foreach (SubmittedNode node in this.mytree.CheckedNodes)
{
save in db
}
}



I make a sample, that message about checkednodes count never showup.
Because CheckedNodes always null.



<%@ 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">

<script runat="server">

protected void getchecknode(object sender, DirectEventArgs e)
{

if (TreePanel1.CheckedNodes != null)
X.Msg.Alert("message", TreePanel1.CheckedNodes.Count.ToString()).Show();

}

</script>




<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<ext:ResourceManager ID="ResourceManager1" runat="server">
</ext:ResourceManager>
<ext:TreePanel ID="TreePanel1" runat="server" Height="300" Title="Title">
<Root>
<ext:Node Text="start">
<Children>
<ext:Node Text="node 1" Checked="false" Leaf="true">
</ext:Node>
<ext:Node Text="node 2" Checked="True" Leaf="true">
</ext:Node>
<ext:Node Text="node 3" Checked="false" Leaf="true">
</ext:Node>
</Children>
</ext:Node>
</Root>
</ext:TreePanel>
<ext:Button ID="Button1" runat="server" Text="click">
<DirectEvents>
<Click OnEvent="getchecknode"></Click>
</DirectEvents>
</ext:Button>
</div>
</form>
</body>
</html>

Daniil
Jun 25, 2012, 1:56 PM
Hi,

Thanks for the report. We will investigate and fix.

For now, please set up the following Before handler for the DirectEvent.

<Click OnEvent="getchecknode" Before="App.TreePanel1.updateCheckSelection();" />

Vladimir
Jun 25, 2012, 7:28 PM
Fixed in SVN