如何根据kendo网格中每条记录的状态隐藏编辑和删除按钮 [英] How to hide edit and delete button based on the status of each record in kendo grid
本文介绍了如何根据kendo网格中每条记录的状态隐藏编辑和删除按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何根据Kendo Grid中每条记录的状态隐藏编辑和删除按钮?
我尝试了什么: < br $> b $ b
How to hide edit and delete button based on the status of each record in Kendo Grid?
What I have tried:
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();
}
})
//Selects all delete buttons
$("#Grid tbody tr .k-grid-delete").each(function () {
var currentDataItem = $("#Grid").data("kendoGrid").dataItem($(this).closest("tr"));
//Check in the current dataItem if the row is deletable
if (currentDataItem.isDeletable == true) {
$(this).remove();
}
})
}
推荐答案
( #Grid tbody tr .k-grid-edit)。each( function (){
var currentDataItem =
("#Grid tbody tr .k-grid-edit").each(function () { var currentDataItem =
( #Grid)。data( kendoGrid)。dataItem(
("#Grid").data("kendoGrid").dataItem(
( this )。nearest( tr));
// 检查当前dataItem是否可以编辑行
if (currentDataItem.isEditable == true ){
(this).closest("tr")); //Check in the current dataItem if the row is editable if (currentDataItem.isEditable == true) {
这篇关于如何根据kendo网格中每条记录的状态隐藏编辑和删除按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文