can jqgrid highlight maximum/minimum cell value from 1 page?
for example
Name | Age
Alex | 25
John | 30 ----> Highlight this row
Peter | 29
page 1 > >>
Thank you for your help,
Best Regards,
Eka
You can use the formatter and get the maximum/minimum value in a cell and the index of that cell. Then, once the grid load is complete, you can add a class to the row that contains the maximum/minimum amount using the index. Here is an example of the solution:
<script type="text/javascript">
jQuery(document).ready(function(){
var mydata = [
{id:"1",name:"Alex",age:25},
{id:"2",name:"John",age:30},
{id:"3",name:"Peter ",age:29}
];
var currentMaxAmount = 0;
var maxAmountIndex = -1;
var currentIndex = 0;
jQuery("#list4").jqGrid({
datatype: "local",
height: 250,
colModel:[
{name:'name',index:'name', width:100},
{name:'age',index:'age', width:80, align:"right",sorttype:"float", formatter: function (cellvalue, options, rowObject) {
if(parseInt(cellvalue) > currentMaxAmount)
{
currentMaxAmount = parseInt(cellvalue);
maxAmountIndex = currentIndex;
}
currentIndex++;
return cellvalue;
}
}
],
multiselect: true,
data: mydata,
loadComplete: function (gridData) {
if(maxAmountIndex > -1)
$($(".jqgrow")[maxAmountIndex]).addClass("highlighted");
}
});
});
</script>
<style>
tr.highlighted > td{
background-color: red;
}
</style>
Hope this helps. Let me know if you have any further questions.