Define a 'formatter' function on the column, change its colour on some conditions. Please refer to this code:
onExpandRow: function(index,row){
var ddv = $(this).datagrid('getRowDetail',index).find('table.ddv');
ddv.datagrid({
url:'datagrid22_getdetail.php?itemid='+row.itemid,
fitColumns:true,
singleSelect:true,
rownumbers:true,
loadMsg:'',
height:'auto',
columns:[[
{field:'orderid',title:'Order ID',width:200},
{field:'quantity',title:'Quantity',width:100,align:'right',
formatter(value){
if (value<0){
return '<span style="color:red">'+value+'</span>'
} else {
return value;
}
}
},
{field:'unitprice',title:'Unit Price',width:100,align:'right'}
]],