【问题标题】:Kendo Jquery Grid - Need to hide Delete button Based on row wise hidden valueKendo Jquery Grid - 需要根据行隐藏值隐藏删除按钮
【发布时间】:2019-06-11 12:07:29
【问题描述】:

我们有一个 kendo jquery 网格,我们需要根据隐藏的列值逐行隐藏删除按钮。它工作正常,但是单击编辑并单击取消后,再次出现删除按钮。在网格数据绑定中,我正在这样做:

 dataBound: function (e) {
                //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 && currentDataItem.source == '2') {
                        $(this).remove();
                    }
                })
            },

请提出建议。

【问题讨论】:

  • 我更喜欢列模板。见here

标签: jquery jquery-ui kendo-ui kendo-grid


【解决方案1】:

不要使用dataBound 事件,而是使用command 列中的visible 属性。这样即使您更新/取消值,它也不会显示删除按钮。

例子:

{ command: [{name: "edit"},{ name: "destroy", visible: function(dataItem) { return dataItem.ProductName!="Chai" } }] }],

以下是可执行示例:

Using visible for destroy command

API 参考: API Reference

【讨论】:

  • 谢谢,虽然由于我们使用的剑道版本较低,我无法使用它。再次感谢
  • 您使用的是哪个剑道版本?
猜你喜欢
  • 2014-05-13
  • 1970-01-01
  • 1970-01-01
  • 2018-08-21
  • 1970-01-01
  • 1970-01-01
  • 2023-01-27
  • 2012-08-25
  • 1970-01-01
相关资源
最近更新 更多