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

Create a Treeview from a ajax call

1 Answer 284 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Benoit
Top achievements
Rank 1
Benoit asked on 29 Jun 2013, 04:13 PM
I try to display a treeview that  I build with ul and li from a ajax call:

<div class="demo-section">
        <ul id="555804139789770" class="treeview">
            <li data-expanded="true">Niveau 1
                <ul>
                    <li data-expanded="true" id="1234">Niveau 1.1
                        <ul>
                            <li data-expanded="true" id="123456">Niveau 1.1.1
                                <ul>
                                    <li data-expanded="true" id="1234567">Niveau 1.1.1.1
                                    </li>
                                </ul>
                            </li>
                        </ul>
                    </li>
                    <li data-expanded="true" id="12345">Niveau 1.2
                    </li>
                </ul>
            </li>
        </ul>
    </div>

There is my javascript  
   
$(".treeview").livequery(function() {
    
        $(this).kendoTreeView({
    
        });
    });

It works but it's slow

Do you have an other way to do that

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 03 Jul 2013, 04:13 PM
Hello,

There does not seem to be nearly enough markup so that the there will be a delay in the initialization. I created a small jsBin example that initializes the treeview from the HMTL that you provided. Do you experience the same delay when running the example on your side?
Besides initializing the treeview from HTML you could also pass the data as demonstrated in this demo or configure the treeview dataSource to load the data with an Ajax request as shown here.

Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
TreeView
Asked by
Benoit
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or