2016-10-05 30 views

回答

1

在數據綁定事件中,你可以根據你的條件刪除編輯按鈕劍道網格中的每一行

嘗試使用此代碼

function onDataBound() { 
//Selects all edit buttons 
$("#Grid tbody tr .k-grid-edit").each(function() { 
    var currentDataItem = $("#Grid").data("kendoGrid").dataItem($(this).closest("tr")); 

    //Check in the current dataItem if the row is editable 
    if (currentDataItem.isEditable == true) { 
     $(this).remove(); 
    }  
}) 
0

如果您使用的是MVC流體API來配置你的網格列然後嘗試此解決方案。

columns.Bound(p => p.MyModelID).Title("My Button Column").Sortable(false) 
    .Width(120) 
    .ClientTemplate("#if(MyModelFieldShowButton){#" + 
     "<button onclick='myButtonClick(#=MyModelID#)' tabindex='0' class='k-button k-button-icontext' id='btnMy#=MyModelID#' role='button' aria-disabled='false' type='button' data-role='button'><span class='k-icon k-i-redo'></span>My Button Text</button>" + 
     "#}else{#" + 
     "<button onclick='myButtonClick(#=MyModelID#)' tabindex='0' class='k-button k-button-icontext' id='btnMy#=MyModelID#' role='button' aria-disabled='false' type='button' data-role='button' disabled><span class='k-icon k-i-redo'></span>My Button Text</button>" + 
     "#}#" 
    ) 
    .HeaderHtmlAttributes(new { title = "Queue the notification for delivery.", style = "text-align:center" } 
);