首页 > Web开发 > 详细

JQuery EasyUI DataGrid根据条件设置表格行样式(背景色)

时间:2016-06-02 11:09:55      阅读:907      评论:0      收藏:0      [点我收藏+]

1.javascript定义函数返回样式

<script type="text/javascript">
    //根据条件设置表格行背景颜色
    function setRowBgColor(index, row) {
        if (row.ERROR_INFO != null && row.ERROR_INFO != "") {
            return ‘background-color:yellow;color:black;‘;
        }
    }
</script>

2.在table的属性中设置rowStyler对应的function未之前定义的setRowBgColor

<table id="gridFileImport" class="easyui-datagrid" style="width:780px;height:420px;" data-options="rownumbers:true,singleSelect:true,selectOnCheck:false,checkOnSelect:false,pagination:true,pageSize:20,url:‘‘,method:‘get‘,striped:true,rowStyler:setRowBgColor">

PS:DataGrid自带的表格隔行变色属性设置striped:true

3.效果图如下:

技术分享

 

JQuery EasyUI DataGrid根据条件设置表格行样式(背景色)

原文:http://www.cnblogs.com/mora1988/p/5552075.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!