我想根据角色隐藏kendo grid命令编辑按钮或删除按钮。 +如果需要,如何隐藏命令列。谢谢
{ command: [{ name: "Details", click: showDetails },
{ name: "Edit", click: onEdit },
{ name: "Delete", click: obDelete, hidden:true}], title: 'Actions', width: 230 }
答案 0 :(得分:3)
以防万一,如果有人需要答案(参考:http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#configuration-columns.command.visible)
<div id="grid"></div>
<script>
$("#grid").kendoGrid({
columns: [
{ field: "name" },
{ command: [{ name: "edit", visible: function(dataItem) { return
dataItem.name==="Jane" } }] }
],
editable: "popup",
dataSource: [ { name: "Jane" }, { name: "Bill" } ]
});
</script>