zl程序教程

您现在的位置是:首页 >  前端

当前栏目

easyui datagrid隔行变色

EasyUI Datagrid 变色 隔行
2023-09-11 14:15:13 时间

属性striped设置为true,即striped:true。

如果想更改颜色,可以更改easyui.css中的.datagrid-row-alt样式。

或者:

<table id="dg" class="easyui-datagrid" style="width: 1000px; height: 300px" 
            data-options="
            rownumbers:true,
            onClickRow:ClickRow,
            singleSelect:false,
            border:true,
            pagination:true,
            url:'DataGridDataHandler.ashx',
           <%-- //隔行变色--%>
            rowStyler: function(index,row){
                    if ((index % 2)==0){
                        return 'background-color:#0000C6;color:#fff;font-weight:bold;';
                    }
                else{
                      return 'background-color:#009100;color:#fff;font-weight:bold;';
                }
                },
            toolbar:'#tb'">