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

column command template param?

4 Answers 754 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kake
Top achievements
Rank 1
Kake asked on 04 Aug 2015, 11:24 AM

Hi
Trying to make a grid containing a button column, where the button displays a locked or unlocked button icon depending on the data source for the row. The button should also toggle the locked property.
Using a “normal” column template it is simple to make the visual part of the task.

{ field: "Locked",
title: "", width: 20, template: '<div
class="btn btn-default"> <i class="#= Locked? "fa
fa-lock" : "fa fa-unlock" # "></i></div>',
filterable: false},

The above code works but does not handle click event.
Using a command field template, the field variables are not available?

{ command:
{ click: toggleLocked,
template: '<div class="btn btn-default"> <i class="#=Last? "fa fa-lock" : "fa fa-unlock" #"></i></div>'
},
width: 20
},

The above code does not work.

 

Any suggestions?

4 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 05 Aug 2015, 08:23 AM

Hello Marius,

The field variables are available in a template column too. Here is a sample implementation of the current scenario. I hope it will help you to implement the scenario on your end.

Regards,
Dimiter Madjarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Kake
Top achievements
Rank 1
answered on 05 Aug 2015, 08:33 AM

Hi

 I know they are available in a template column,, But I not able to make it work in a "command" template button.. 

 

0
Dimiter Madjarov
Telerik team
answered on 05 Aug 2015, 02:38 PM

Hello Marius,

Is the provided example not applicable to the current case? You could add the k-button CSS class to the buttons to make them look like Grid commands. Here is the updated example.

Regards,
Dimiter Madjarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Kake
Top achievements
Rank 1
answered on 05 Aug 2015, 03:13 PM

Hi Dimiter

Tnx for the reply.

 The solution you provide can be used to solve my problem, I where hoping there where a another way to do it (by command click events etc..)

I can live with the provided solution :-)

Tags
Grid
Asked by
Kake
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Kake
Top achievements
Rank 1
Share this question
or