This is a migrated thread and some comments may be shown as answers.

populating child nodes question

0 Answers 53 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Gary
Top achievements
Rank 1
Gary asked on 19 May 2011, 10:20 PM

I've run into a little problem on my side with the radtreeview. I'm trying to build a treeview based on a folder structure on a server that will allow an user to select which folders another user has access to. I can dymanically load everything and save just fine. The problem is when I come back to a new instance of the radtreeview, I have just the basic level node (in this case folder) and the tri-state is uncheked as it doesn't have any children yet (as expected because the tree doesn't know about the folders yet).

What's the best way to pre-load this list of existing checked boxes and still allow it to load the rest of the folders via ajax when the user clicks on the node. There are about 100 folders, each with about 50 subfolders which each contain another 10-50 subfolders (around 100k folders in total). Because of this, preloading will be painfully slow. The thing is that each user only has about access to 20 or so folders usually under one of the lower chains.

If someone has some sample code or ideas for pre-loading specific levels, including checking only those, and then fully populating when the expand a higher level I would greatly appreciate it. I do have a web service that returns the list of folders they have access to but I'm not sure of when/how I should call it in the scope of this.

For the loading the nodes via AJAX we use the code below (which is pretty much from the samples):

I figured I'd attempt to load the list of authorized folders in the load method (as show below) but that fails:

Actual Control:

 

<telerik:RadTreeView ID="RadTreeView1" runat="server" CheckBoxes="True" TriStateCheckBoxes="True"
    OnClientLoad="load" OnClientNodeDataBound="nodeDataBound" OnClientNodePopulating="nodePopulating"
    OnClientNodeClicked="nodeClicked" OnClientNodePopulated="nodePopulated" Skin="Outlook">
    <WebServiceSettings Path="~/Services/Directories.asmx" Method="GetDirectories" />
    <DataBindings>
        <telerik:RadTreeNodeBinding ImageUrlField="ImageUrl" TextField="Text" ValueField="Value" />
    </DataBindings>
</telerik:RadTreeView>

The true problem is when I save back, if the user hasn't loaded the final nodes that are currently selected, they are lost.

No answers yet. Maybe you can help?

Tags
TreeView
Asked by
Gary
Top achievements
Rank 1
Share this question
or