jqgrid bug: cellattr with -style sintax
jgrid POST:
http://www.trirand.net/forum/default.aspx?g=posts&m=12248&#post12248
HTML
<link rel="stylesheet" href="http://trirand.com/blog/jqgrid/themes/ui.jqgrid.css">
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/themes/base/jquery-ui.css">
<script src="http://trirand.com/blog/jqgrid/js/i18n/grid.locale-en.js"></script>
<script src="http://trirand.com/blog/jqgrid/js/jquery.jqGrid.js"></script>
<table id='myTable'></table>
CSS
.gmExtra{
font-size:15px;
background-color: #59cf59;
color:white;
}
.gmTop{
font-size:15px;
background-color: #ff6666;
color:white;
}
.gmMed{
font-size:15px;
background-color: #ff3333;
color:white;
}
.gmLow{
font-size:15px;
background-color: #cc0000;
color:white;
}
JavaScript
console.clear();
function __columnStyle(rowid, cellValue, rawData, colModel, rowData) {
if (colModel.name == "desc")
return "style='font-weight: bold;'"
else
return "style='font-style: italic;'"
}
function rowStyle(rowData, currentObj, rowid){
return {style: "color: blue",class:"gmExtra"};
}
var myData = [
{"id": 1, "cell": [1,"ITEM01","2013/01/01"]},
{"id": 2, "cell": [2,"ITEM02","2013/01/01"]},
{"id": 2, "cell": [2,"ITEM02","2013/01/01"]}
];
var grid = jQuery("#myTable");
grid.jqGrid({
colModel : [
{ name: "order", width: 70, align: "right", formatter: "integer" },
{ name: "desc", width: 100, cellattr:__columnStyle },
{ name: "date", width: 80, formatter: "date", cellattr:__columnStyle }
],
rowattr:rowStyle,
height: "auto",
datastr: myData,
datatype: "jsonstring",
jsonReader: { "root": function(obj){return obj;} }
});