easyui datagrid隔行变色

属性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'">

 

posted @ 2022-10-04 00:14  IT情深  阅读(154)  评论(0编辑  收藏  举报