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

showing expand icon

3 Answers 79 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
mirang
Top achievements
Rank 1
mirang asked on 03 Jan 2012, 07:46 AM
I need to show expand icon against each node as the child nodes(if any) would be populated on demand. I dont want to use Load on demand directly, because our application can have more than 4000 child nodes(around 50000-100000). 
Is there any way by which the child nodes will have the expand icon without keeping the expandmode=webservice, so that when the user expands the node, on client side the ajax request will fire and will bring the child nodes and keep appending it on regular intervals(or through webworkers in case of html5).

3 Answers, 1 is accepted

Sort by
0
Ivan Zhekov
Telerik team
answered on 03 Jan 2012, 01:20 PM
Hello, Mirang.

The expand icon is displayed if a certain HTML is present in the node e.g.:

<li class="rtLI">
    <div class="rtMid">
        <span class="rtSp"></span>
        <span class="rtMinus"></span>
        <span class="rtIn">Node Name</span>
    </div>
    <ul class="rtUL">
        ...
    </ul>
</li>

And if you do not set the expand mode, it will be missing. You could write your own styles of course, but it might break something.

So what you can do is walk each div.rtMid that's in a li.rtLi and appen the span.rtMinus or span.rtPlus e.g.

$( "#RadTreeView1" ).find( "li.rtLI" ).children( "div.rtMid" ).append( "<span class=\"rtMinus\"></span>" )

The above snippet will add the missing spans.

Do note that this snippet needs to be tweaked so you only add those spans once in case you run it again. Also, you'll need to set the proper class of the span so it expands and collapses visually.

One last thing, such behaviour may break the tree view. True, using the build in names will spare you from writing custom CSS, but could trigger internal events, hence yielding more troubles than gains.

Regards,
Ivan Zhekov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
mirang
Top achievements
Rank 1
answered on 03 Jan 2012, 01:46 PM
Thanks for the reply. 
In case of load on demand using webservice, is there any way we can get the data returned from webservice before binding it to the Tree Node. I am asking this because, if its available then if we have > 4000 records, we can call the webservice using load on demand feature of radtreeview, and when the data is returned, before populating the childnodes on the UI, using javascript, out of 5000 records we can only take say 100-500 nodes at a time and then based on javascript timer / html5 webworker go on adding other nodes?
0
Bozhidar
Telerik team
answered on 03 Jan 2012, 05:13 PM
Hello Mirang,

I've attached a sample page showing a custom load on demand scenario. I believe that it is what you are looking for. When you expand a node, it adds a "ShowMode" node after loading 10 items. When you click this node, it loads the next 10 and so on, until all items are loaded.

Feel free to modify the page to suit your needs.

Regards,
Bozhidar
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
TreeView
Asked by
mirang
Top achievements
Rank 1
Answers by
Ivan Zhekov
Telerik team
mirang
Top achievements
Rank 1
Bozhidar
Telerik team
Share this question
or