Hi is it possible to format a row cell & column cell on Max values? For example read through a row/column and hi-lite the highest value?
I note the operators as eq', 'ne', 'lt', 'le', 'gt', 'ge', 'bw', 'bn', 'ew', 'en', 'cn', 'nc', 'nu', 'nn', 'in', 'ni' but cant see one for max value
I've prepared a demo for min/max value conditional formatting.
This is done with JS code and only format what are on current page.
https://gist.github.com/gridphp/12895a38ff7681c4519fb461301bcadd
99,108-119,137-143
Fantastic Abu, really helpful to see the code. Can I ask what the 'ids' refers to ion this as I cannot make it work in any of my pages?
In my example below I have 12 columns, one for each month. I tried to test it on column name 'Jan' but that doesnt work?
<script>
function grid_onload(ids)
{
var low;
var low_index;
var high;
var high_index;
if(ids.rows)
jQuery.each(ids.rows,function(i)
{
// find lowest value
if (low == undefined || parseInt(this.Jan) < low)
{
low = parseInt(this.Jan);
low_index = i;
}
// find highest value
if (high == undefined || parseInt(this.Jan) > high)
{
high = parseInt(this.Jan);
high_index = i;
}
});
// highlight lowest client id
jQuery('#list1 tr.jqgrow:eq('+low_index+')').css('background-image','inherit');
jQuery('#list1 tr.jqgrow:eq('+low_index+') td[aria-describedby=list1_Jan]').css('background','inherit').css({'background-color':'#000', 'color':'white'});
// highlight highest client id
jQuery('#list1 tr.jqgrow:eq('+high_index+')').css('background-image','inherit');
jQuery('#list1 tr.jqgrow:eq('+high_index+') td[aria-describedby=list1_Jan]').css('background','inherit').css({'background-color':'red', 'color':'white'});
}
</script>
Hi Abu, please ignore my last post I figured it out, forgot to add the line $grid["loadComplete"] = "function(ids) { grid_onload(ids); }";
Apologies. Works great, if I want to use this on 12 columns would I need to recreate the script above for each column (1 per month, Jan, Feb, Mar etc etc etc