EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: taliguci on December 05, 2016, 09:51:40 PM



Title: datagrid cells change background color
Post by: taliguci on December 05, 2016, 09:51:40 PM
hi guys..
i use this code to change background color if meet the condition, high or low. unfortunately, its works just at 1 cell. how to applied on the other cell?

Code:
<script>

$(function (){
var dg = $('#tbbe1b');
var col = dg.datagrid('getColumnOption','ti_507' );
col.styler = function(index,col){
if (col.ti_507<200 ){
return 'background-color:pink;color:blue;font-weight:bold'; //'background-color:#f6ced8';
}
else if (col.ti_507>239 ){
return 'background-color:pink;color:blue;font-weight:bold'; //'background-color:#f6ced8';
}
else  {
return (col.ti_507);
}
};
dg.datagrid('refreshRow',index);
});
</script>


Title: Re: datagrid cells change background color
Post by: stworthy on December 06, 2016, 02:14:39 AM
Please look at this example http://www.jeasyui.com/demo/main/index.php?plugin=DataGrid&theme=default&dir=ltr&pitem=DataGrid%20Cell%20Style