Template for command button

2 Answers 2997 Views
TreeList
Sergey
Top achievements
Rank 1
Sergey asked on 23 Sep 2015, 08:57 AM

I want to ask the question about template for command button in TreeList. It seems it it ignored in case of TreeList, although it work fine in Grid (see attached picture).

columns: [
    { field: "groupName", title: "Group", width: 100 },
    { field: "vesselName", title: "Vessel", width: 100 },
    {
        command: [
            { name: "destroy", text: " ", template: "<a class='k-button k-grid-delete'><span class='glyphicon glyphicon-remove'></span></a>" }
        ],
        title: "Action",
        width: "15px"
    }
],

What I want to achieve by that template is just use another icon from bootstrap styles. Currently to achieve this (as workaround) I have to manipulate with DOM via jQuery, what of course not nice. 
Does it not supported by design, or there is mistake in my code?

2 Answers, 1 is accepted

Sort by
0
Accepted
Alexander Popov
Telerik team
answered on 25 Sep 2015, 09:17 AM
Hello Sergey,

I apologize for misleading you. The template should be used as column template, as shown in this updated example.

Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Sergey
Top achievements
Rank 1
commented on 25 Sep 2015, 09:29 AM

Now it works.

Thanks a lot!

Abhijeet
Top achievements
Rank 1
commented on 03 Aug 2016, 08:41 AM

Hello Alexander,

Your answer is diffidently helping in case of destroy button, But in my case i am trying to do inline edit for TreeList Control using custom template, like below button

<button data-command="edit" class="k-button k-button-icontext k-grid-edit"></span> edit</button>

This button is not showing update & Cancel after clicking on Edit Can you help me.

 

Thanks,

Abhijeet

Alexander Popov
Telerik team
commented on 05 Aug 2016, 09:16 AM

Hi Abhijeet,

I am afraid this replacing the custom Edit button with Update/Cancel buttons is not supported. In case you are trying to apply some different styling I would recommend using CSS instead.

Regards,
Alexander Popov
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
0
Alexander Popov
Telerik team
answered on 25 Sep 2015, 08:21 AM
Hello Sergey,

The TreeList uses a different markup for the destroy command -  here is an example.

Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Sergey
Top achievements
Rank 1
commented on 25 Sep 2015, 09:00 AM

Hello Alexander

 Thanks for answer. But it seems even in your example template attribute is ignored. As there is no word "Delete" in final result, in right panel.

<button data-command="destroy" class="k-button k-button-icontext k-grid-delete"><span class="k-icon k-delete"></span>Delete</button>

I also tried to play with it and change template attribute to arbitrary text - and still no effect (of course I pressed Run button after each change). See attached screenshots.
Either I'm doing smth wrong or template attribute is just ignored during rendering TreeList. 

Tags
TreeList
Asked by
Sergey
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or