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

时间:2016-06-02 11:09:55   收藏:0   阅读:909

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.效果图如下:

技术分享

 

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

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!