This is a migrated thread and some comments may be shown as answers.
Grid Columns Command Edit().Template How to pass data item
1 Answer 112 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Meypar asked on 16 Oct 2019, 09:12 AM


I'm trying to add a custom edit button with dataitem information to grid because I need to check each row property value "Permission" to show the button or not.

I built this code (each comment // Line # identifies one test):

<script id="grid-button-edit-template" type="text/x-kendo-template">
    #if(data.Permission >= 3) {#
        <a class="k-button k-grid-edit">Edit</a>
<script type="text/javascript">
    var actionButtonsTemplate = kendo.template($('#grid-button-edit-template').html());
        .Columns(columns =>
            columns.Command(c =>
                // Line #1
                // Line #2
                // Line #3
            // Line #4


I have a couple of issues:

In Line #4 everything is Ok but

 - When I set edition InLine the buttons [Save] & [Cancel] don't appear

 - On edition PopUp I can't set [Save] & [Cancel] text values (Like I do with c.Edit().UpdateText("My Text Update"))

Lines #1, #2, #3 don't work, I can't pass the dataitem information to the template.

Which one is the best approach? How I can solve the issues?



1 Answer, 1 is accepted

Sort by
Alex Hajigeorgieva
Telerik team
answered on 18 Oct 2019, 06:22 AM

Hi, Maypar,

If I understand the requirement correctly, you can use the button's Visible() method which allows you to provide a JavaScript script function name. In the function, you receive the dataItem as an argument so you can check per row if the button will be visible or not:

columns.Command(c => c.Edit().Visible("hasPermission"));

    function hasPermission(dataItem) {        
        return dataItem.Permission >= 3;

Kind Regards,
Alex Hajigeorgieva
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Asked by
Top achievements
Rank 1
Answers by
Alex Hajigeorgieva
Telerik team
Share this question