我想根据 Kogrid 中的列值更改行的字体颜色?请指导我如何设置它?我试过以下:
<div id="grid" style="height: 700px; width: 650px;"
data-bind="koGrid: {
data: gridItems, afterSelectionChange: function (rowItem, event) {
if (event.type == 'click' && isDoubleClick(self.clickTime, event.timeStamp)) {
location.href = '/Home/Index?AcctID=' + selObj()[0].AcctID.toString();
}
}, columnDefs: [{ field: 'AcctID', displayName: ' ',width: 120, cellTemplate: $('#editCellTemplate').html()
},
{ field: 'AcctID', displayName: ' ',width: 120, cellTemplate: $('#openCellTemplate').html()
},
{ field: 'FName', displayName: 'First Name', width: '150' },
{ field: 'LName', displayName: 'Last Name', width: '100' },
{ field: 'AcctID', displayName: 'AcctID', width: '100' },
{ field: 'SSN', displayName: 'SSN', width: '100' },
{ field: 'AffinityName', displayName: 'Affinity Name', width: '205' }],
autogenerateColumns: false,
isMultiSelect: false,
showFilter: true,
showColumnMenu: true,
enablePaging: false,
showGroupPanel: true,
displaySelectionCheckbox: false,
enableColumnResize: false,
multiSelect: false,
selectedItems: selObj,
canSelectRows: true ,
rowTemplate:$('#searchRowTemplate').html()
}">
</div>
<script type="text/html" id="searchRowTemplate">
<div data-bind="foreach: $grid.visibleColumns,
css: { red: getProperty(\'SSN\') == '123456789' }">
<div data-bind="attr: { \'class\': cellClass()
\' kgCell col\' + $index() }, kgCell: $data"></div>
</div>
</script>
它给出了:- Uncaught SyntaxError: Unable to parse bindings。绑定值:foreach: $grid.visibleColumns, css: { red: getProperty(\'SSN\') == '123456789' } 消息:意外令牌非法
不知道如何获得完整行的红色字体颜色,其中我的列 ssn = 123456789 和 fname = john.
请提出解决方案。