Dec 08, 2009, 7:16 AM
[CLOSED] [1.0] TreePanel add node at DirectEvent
Hi Vlad,
I updated to the new version, but I have still problems adding a Node to a TreePanel in code behind DirectEvent.
The code executes well, the new item - menu item - is inserted into the DB but when I tried with the following code, sometimes it updates the Tree so that I can see the new node and sometimes not!
I can't understand how to solve it.
Matteo
I updated to the new version, but I have still problems adding a Node to a TreePanel in code behind DirectEvent.
The code executes well, the new item - menu item - is inserted into the DB but when I tried with the following code, sometimes it updates the Tree so that I can see the new node and sometimes not!
I can't understand how to solve it.
<ext:TreePanel ID="TreePanelPortale"
BodyStyle="background-color:#F4F4F4; padding:2px;"
Mode="Remote"
UseArrows="true"
runat="server"
Width="200"
Border="false"
AutoScroll="true"
Title="Gestione Menu"
Animate="true"
EnableDD="true"
AllowLeafDrop="false"
OnRemoteMove="TreePanelPortale_RemoteMove">
<Loader>
<ext:PageTreeLoader OnNodeLoad="NodeLoad">
</ext:PageTreeLoader>
</Loader>
<Root>
<ext:AsyncTreeNode NodeID="0" Text="Portale" />
</Root>
<Listeners>
<BeforeNodeDrop Fn="beforeDrop" />
<ContextMenu Handler="#{cmenu}.node = node; node.select(); #{cmenu}.showAt(e.getPoint());" />
</Listeners>
<DirectEvents>
<Click OnEvent="TreePanelPortale_Click">
<ExtraParams>
<ext:Parameter Mode="Raw" Value="node.id" Name="PRM_NodeId">
</ext:Parameter>
<ext:Parameter Mode="Raw" Value="node.href" Name="PRM_NodeHref">
</ext:Parameter>
</ExtraParams>
</Click>
</DirectEvents>
</ext:TreePanel>
In DirectEvent triggered by a button in the page - it retieves the textbox value for the new node to be added
// insert new item in the db
...
string _nodeId = (_mItem.ParentNode != null) ? _mItem.ParentNode.Oid.ToString() : "0";
this.TreePanelPortale.AddScript("{0}.getNodeById('{1}').reload();", this.TreePanelPortale.ClientID, _nodeId);
ThanxMatteo