Hello,
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><script type="text/javascript"> var actionButtonsTemplate = kendo.template($('#grid-button-edit-template').html());</script>@(Html.Kendo().Grid<MyModel>() .Name("GridName") .Columns(columns => { columns.Command(c => { // Line #1 c.Edit().TemplateId("grid-button-edit-template"); // Line #2 c.Edit().Template("#=actionButtonsTemplate(data)#"); // Line #3 c.Edit().Template("grid-button-edit-template"); }); // Line #4 columns.Template("#=actionButtonsTemplate(data)#"); }) ...)
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?
Regards,
Ivan
