简体   繁体   English

剑道网格可编辑高亮颜色

[英]Kendo Grid editable highlighted color

I had this kendo demo here , want I to achieve, highlighted color only appear once on edited row.我在这里有这个剑道演示,希望我实现,突出显示的颜色只在编辑的行上出现一次。 Currently the highlighted color appear duplicate when I edit multiple row.当前,当我编辑多行时,突出显示的颜色出现重复。 How to fixed this?如何解决这个问题? Appreciate your help.感谢你的帮助。

DEMO演示

When you already modify it that way, you can reset color by row index, if its even set it to gray if its odd set it to white and set it to blue if modified:当您已经以这种方式修改它时,您可以按行索引重置颜色,如果它even将其设置为灰色,如果其odd将其设置为白色,并在修改时将其设置为蓝色:

function highlightBlue() {
    var grid = $("#grid").data("kendoGrid");
    var data = grid.dataSource.data();

    $.each(data, function (i, row) {
        var item = $('tr[data-uid="' + row.uid + '"]');
        if (item[0].rowIndex % 2 !== 0) {
            item.css("background-color", "#f6f6f6");
        } else {
            item.css("background-color", "white");
        }
        if (row.Modified == "Y") {
            item.css("background-color", "#64B5F6");
        }
    });
}

Your modified version: highlight row您的修改版本:突出显示行

EDIT:编辑:

To make it easier you can add class on cell select and remove class on cell close.为了更容易,您可以在单元格选择上添加类并在单元格关闭时删除类。

<style>
    .highlight {
      background-color: red !Important;
    }
</style>
.....
edit: function(e){
    $(e.container[0]).closest("tr").addClass("highlight");
},
cellClose: function(e) {
    $(e.container[0]).closest("tr").removeClass("highlight");
}

With this way we preserve the background colors, here is updated code: On cell open and close通过这种方式,我们保留了背景颜色,这里是更新的代码:打开和关闭单元格

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM