WebTreeView node.LoadChildNodesOnDemand from client side

1 reply. Last post: March 15, 2010 5:56 AM by Glenn Layaar
Tags :
  • New Discussion
  • New Question
  • New Product Feedback

Hi, 

     I am using WebTreeView in LoadOnDemand  mode. 

<ISWebTreeView:WebTreeView ID="WebTreeViewFolders" runat="server" 
                Height="500px" Width="250px" DataSourceID="" EnableLoadOnDemand="True" 
                oninitializenode="WebTreeViewFolders_InitializeNode" 
                oninitializechildnodes="WebTreeViewFolders_InitializeNode" 
                PostBackModeType="FlyPostBack">
                <FlyPostBackSettings PostInputControls="True" />
                <Nodes>
                    <ISWebTreeView:WebTreeViewNode Name="Folders" Text="Folders" TextImage="~/images/ico/16/folder.gif" >
                    </ISWebTreeView:WebTreeViewNode>
                </Nodes>
                <ClientSideEvents OnNodeSelect="WebTreeViewFolders_OnNodeSelect" />
                <NodeSettings EnableAnimation="True" />
            </ISWebTreeView:WebTreeView>



 I am trying to add new folder to hierarchy (folders_structure.jpg) using ajax because your solution using postback is not possible.

function SaveFolder(iFOLDER_ID, sFOLDER_NAME, iFOLDER_ID_PARENT) {
    $.ajax({
        type: "POST",
        url: ......
        data: "{'FOLDER_ID':'" + iFOLDER_ID + "','FOLDER_NAME': '" + sFOLDER_NAME + "','FOLDER_ID_PARENT': '" + iFOLDER_ID_PARENT .......
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(oResult) {
            var iFOLDER_ID = oResult.d
            if (!isNaN(iFOLDER_ID)) {
                var WebTreeViewFolders = ISGetObject("WebTreeViewFolders");
                var node = WebTreeViewFolders.GetSelectedNode();
                //node.Collapse();
                //node.SetChanged();
                //node.Expanded = false;                                
                //node.OldExpanded = false;
                node.ChildNodeExpandable = true;
                node.IsDirty = true;
                node.LoadChildNodesOnDemand();
                node.Expand();
                //node.ExpandHierarchyAndSelect();
            } 
        },
        error: function(result) {
            alert("Status:" + result.status + ', Error:' + result.statusText);
        }
    });
}

 After adding new folder to the database I want to refresh selected node to get new structure. Unfortunatele if selected node is expanded I can't load new structure from the databes because it remembers old one. How to refresh node implicitly from database even if node is expanded. 

Regards,

Mariusz

All times are GMT -5. The time now is 8:59 AM.
Previous Next