您的位置:首页 > 产品设计 > UI/UE

EasyUI 中GridView 满足某条件 改变行的背景色

2016-02-01 16:17 537 查看
<table id='grid' class='easyui-datagrid' style='width:1500px;height:450px' url='Ajax-index.php?module=<{$module_name}>&action=Ajax_GridView_Select_Dispose&assigned_user_id=<{$assigned_user_id}>&start_time=<{$start_date}>&stop_time=<{$stop_date}>'
title='投诉列表' iconCls='icon-table' pagination='true' rownumbers='true' fitColumns='true' singleSelect='true' toolbar='#toolbar'
data-options="rowStyler: function(index,row){ return RowStyle(index,row); }" >
<thead>

重点:data-options="rowStyler: function(index,row){ return RowStyle(index,row); }"

<script type='text/javascript'>
function RowStyle(index,row){
  //alert(row.send_date);//undefined //取行中的列值
  if(row.send_date!=undefined){
    var date_now=GetDateTime();//alert(date_now);//取当前时间
    date_diff=GetDateDiff(row.send_date, date_now, "day");//alert(date_diff);//时间差
    //var date_diff=GetDateDiff("2010-02-26 16:00:00", "2011-07-02 21:48:40", "day");alert(date_diff);//时间差
    if(date_diff>2){//超过2天时 红色背景色
      return 'background-color:#CF0C29;color:#fff;font-weight:bold;';
    }
  }
}

</script>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: