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

Treeview - add html to item

6 Answers 136 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Ron
Top achievements
Rank 1
Ron asked on 06 Jul 2012, 04:34 PM
Complete Code From here:
http://pastebin.com/LHa83w57 

OR:



          
<script>
          -
 
$("#treeview-images").kendoTreeView({
    dataSource: [
        {
            text: "Inbox", imageUrl: "../../content/web/treeview/mail.png",
            items: [
                { text: "Read Mail", imageUrl: "../../content/web/treeview/readmail.png" },
              { text: "Read Mail", imageUrl: "../../content/web/treeview/readmail.png" },
              { text: "adasd" , imageUrl: "../../content/web/treeview/readmail.png" }
               
            ]
        },
        {
            text: "Drafts", imageUrl: "../../content/web/treeview/edit.png"
        },
        {
            text: "Search Folders", expanded: true, imageUrl:"../../content/web/treeview/search.png",
            items: [
                { text: "Categorized Mail", imageUrl: "../../content/web/treeview/search.png" },
                { text: "Large Mail", imageUrl: "../../content/web/treeview/search.png" },
                { text: "Unread Mail", imageUrl: "../../content/web/treeview/search.png" }
            ]
        },
        {
            text: "Settings", imageUrl: "../../content/web/treeview/settings.png"
        }
    ]
});
          </script>


How is this possible? I have tried:
{ text: document.write('Read  <br> Mail'); , imageUrl:"../../content/web/treeview/readmail.png" }, 

But then it does not display me anything (not even the tree View).  
 

6 Answers, 1 is accepted

Sort by
0
Young
Top achievements
Rank 1
answered on 20 Nov 2013, 04:24 AM
I got same problem.
I have a function that worked fine with Telerik UI. and I am trying to convert to Kendo UI.

function AppendTxt(id, txt, url) {
    //var itemData = { Value: id, Text: txt, ImageUrl: url }; //worked fine with Telerik UI
    var itemData = { id: id, text: txt, imageUrl: url }; //Not working with Kendo
    var itemData = { id: id, text: txt }; //Not working with Kendo

    treeView().append(itemData);
}
What is it? Kendo doc is sucks too. No functional help can be found from Telerik.com site.
What can we possible find api information?
0
Alex Gyoshev
Telerik team
answered on 22 Nov 2013, 07:33 AM
Hello Young,

The TreeView API demo shows how to use the append method on an existing tree. We are sorry that you didn't find what you were looking for in the documentation -- could you be more specific what information you need? We could not find a problem in the snippet you sent, perhaps reproducing the problem in a sample jsBin will show it?

Regards,
Alex Gyoshev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Young
Top achievements
Rank 1
answered on 22 Nov 2013, 02:36 PM
The below function used to work with TelerikTreeview before.
How can I add new child on Kendo treeview with image icon? I like to show a small image along with text.
This node used to have an ID too. How to add ID on each node?

function AppendTxt(id, txt, url) {
    //var itemData = { Value: id, Text: txt, ImageUrl: url }; //worked fine with Telerik UI
    var itemData = { id: id, text: txt, imageUrl: url }; //Not working with Kendo
    var itemData = { id: id, text: txt }; //Not working with Kendo

    treeView().append(itemData);
}

2 days and 10 hours ago in reply to Ron (Link to this post)

I got same problem.
I have a function that worked fine with Telerik UI. and I am trying to convert to Kendo UI.

function AppendTxt(id, txt, url) {
    //var itemData = { Value: id, Text: txt, ImageUrl: url }; //worked fine with Telerik UI
    var itemData = { id: id, text: txt, imageUrl: url }; //Not working with Kendo
    var itemData = { id: id, text: txt }; //Not working with Kendo

    treeView().append(itemData);
}
What is it? Kendo doc is sucks too. No functional help can be found from Telerik.com site.
0
Alex Gyoshev
Telerik team
answered on 25 Nov 2013, 11:08 AM
Hello Young,

Which Kendo UI version are you using? Here is a sample that shows that the API works with the 2013.Q2 version.

Regards,
Alex Gyoshev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Young
Top achievements
Rank 1
answered on 25 Nov 2013, 02:45 PM
I am using
    Kendo UI Complete v2013.2.918.
    Script.Include("kendo.web.min.js");
    Script.Include("kendo.aspnetmvc.min.js");
    jQuery 1.9.1.js

Can I add ID as well?

treeview.append([
      {id: "Id1", text: "qux", imageUrl: "http://demos.kendoui.com/content/web/treeview/search.png" },
      {id: "Id2", text: "cat", imageUrl: "http://demos.kendoui.com/content/web/treeview/mail.png" }
    ]);

thanks,
0
Alex Gyoshev
Telerik team
answered on 28 Nov 2013, 09:18 AM
Hello Young,

Yes, you can. I have updated the jsBin sample to show this. Are you experiencing a problem with this functionality?

Regards,
Alex Gyoshev
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
Ron
Top achievements
Rank 1
Answers by
Young
Top achievements
Rank 1
Alex Gyoshev
Telerik team
Share this question
or