mergeGridColCells($(this),"AdminType");

 

function mergeGridColCells(grid,rowFildName)

{   

     var rows=grid.datagrid('getRows' );    

    //alert(rows.length);       

//alert(rows[1][rowFildName]);     

   var startIndex=0;       

var endIndex=0;     

   if(rows.length< 1)   

    {            

  return;    

   }      

$.each(rows, function(i,row){     

         if(row[rowFildName]==rows[startIndex][rowFildName])     

        {              

     endIndex=i;         

    }              else         

    {              

     grid.datagrid( 'mergeCells',{                      

   index: startIndex,              

           field: rowFildName,   

                      rowspan: endIndex -startIndex+1      

             });              

     startIndex=i;       

            endIndex=i;    

         }

      });  

grid.datagrid( 'mergeCells',{         

          index: startIndex,         

          field: rowFildName,        

           rowspan: endIndex -startIndex+1     

  });

}

 

*参数说明

grid:        easyUI的datagrid对象
rowFildName: 和并列的field属性值
posted on 2016-04-01 10:46  三人之行,必有我师  阅读(292)  评论(1编辑  收藏  举报