我有 21 行的网格。我的要求是设置一些行背景颜色为浅绿色(如1、5、13行)是否可以实现。
$("#gridSellIn")
.kendoGrid({
width: 1500,
dataSource: data.d,
resizable: true,
selectable: true,
rowTemplate: kendo.template($("#SellInrowTemplate").html()),
height: 500,
columns: [
{ title: 'RevProduct Name', field: 'ProductName', width: '22%', sortable: true },
{ title: 'Actuals', field: 'Actual', width: '8%', sortable: true },
]
});
最佳答案
你可以尝试这个条件方法
var grid = $("#gridSellIn").data("kendoGrid");
var data = grid.dataSource.data();
$.each(data, function (i, row) {
if (row.ProductName == 'Apples')
$('tr[data-uid="' + row.uid + '"] ').css("background-color", "green");
}
关于jquery - 如何在 Kendo UI Grid 中设置行背景颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13744315/