直接上代码:
$(function () {
dataGridAccept = $('#dataGridAccept').datagrid({
fit: true,
fitColumns: false,
border: false,
pagination: false,
idField: 'id',
striped: true,
remoteSort: false,
pageSize: 20,
pageList: [5, 10, 20, 80, 100],
sortOrder: 'asc',
singleSelect: true,
checkOnSelect: true,
selectOnCheck: true,
nowrap: true,
showPageList: false,
enableRowContextMenu: false,
url: "${pageContext.request.contextPath}/match.do",
columns: [[{
field: 'id',
title: '抛出ID',
width: 100,
align: 'center',
sortable: false,
hidden: true
}, {
field : 'del',
title : '是否终止',
width : 100,
align:'center',
sortable : false,
hidden:false
}]],
toolbar: '#toolbar',
onLoadSuccess: function () {
$(this).datagrid('tooltip');
$(this).datagrid('clearSelections');
},
rowStyler: function (index, row) {
if(row.del=='1'){
return 'background-color:red;';
}
},
onClickRow: function (index, row) {
}
});
});
关键代码:
rowStyler: function (index, row) {
if(row.del=='1'){
return 'background-color:red;';
}
}
这里就可以了~