3 番目と 4 番目のセル (TD) の値を取り出して比較する方法がわかりません。それらが同じ値を持っている場合、cssClass を行に追加したいと思います。それを行う方法もわかりません:
$("#grid tr").each(function() {
var theValueInCell3 = ? // how to get the cell's value?
var theValueInCell4 = ? // how to get the cell's value
if (theValueInCell3 == theValueInCell4)
{
//pseudo-code to add a cssClass to the row
$(this).addClass('foo');
}
});
編集:これは@Pechkaの提案に従おうとする私の最新の試みです:
.
.
.
if (grid != null) {
grid.dataSource.data(parsedData);
setTimeout(StyleRows, 500);
}
function StyleRows() {
var grid = $('#grid').data('kendoGrid');
$("#grid tr").each(function () {
var dataItem = grid.dataItem(this); // dataItem is undefined
if (dataItem.PropA == dataItem.PropB) {
$(this).addClass('foo');
}
});
}
エラーは、dataItem
未定義です。