EasyUI Forum
June 21, 2024, 01:31:44 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: datagrid cells change background color  (Read 8729 times)
taliguci
Newbie
*
Posts: 6


View Profile Email
« 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>
« Last Edit: December 06, 2016, 01:15:05 AM by taliguci » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!