使命令按钮在Kendo网格中不可见 [英] Make Command Button invisible in Kendo Grid

查看:50
本文介绍了使命令按钮在Kendo网格中不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Kendo UI的新手.在我的代码中,正在创建列,如下所示.

I am new to kendo UI. In my code, columns are getting created as shown below.

grid = $('#grid').kendoGrid({
            columns: [
                {
                    width: 75,
                    command: [{
                        name: "Tag",
                        click: function (e) {
                            try {
                             } catch (ex) {
                                alert(ex.message);
                            }
                        }
                    }]
                },
               { field: "Col18", title: "IsTag", width: 75 },
               { field: "Col8", title: "System", width: 75 },
          ],

现在,在数据绑定中,基于数据源中的值,它们正在更改行的颜色,如下所示.我的问题是,如果颜色是绿色,我想隐藏命令按钮.我该如何做到这一点.

Now, in the databound, based on the value from datasource, they are changing the color of the row as show below. My issue is, if the color is green, I want to hide the command button. How can I achieve this.

 dataBound: function () {
                dataView = this.dataSource.view();
                for (var i = 0; i < dataView.length; i++) {
                    var obj = $("#grid tbody").find("tr[data-uid=" + dataView[i].uid + "]");
                    switch (dataView[i].Aklr) {
                        case "R":
                            obj.addClass("red");
                            break;
                        case "R+":
                            obj.addClass("darkred");
                            break;
                        case "G":
                            obj.addClass("green");
                             break;
                    }

                }
            }

推荐答案

在这里,我找到了答案.

Here, I find the answer.

$(#grid tbody").find("tr [data-uid =" + dataView [i] .uid +] td:eq(0)").html(");

$("#grid tbody").find("tr[data-uid=" + dataView[i].uid + "] td:eq(0)").html("");

这篇关于使命令按钮在Kendo网格中不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆