绿色环保
千呼万唤死出来,一生一世很精彩

可以再onLoadSuccess的方法里处理下 

var rows=$('#tbList').datagrid("getRows");//获取行的数据
                     for(var i=0;i<rows.length;i++){

       //根据情况判断相同的数据,我这里是根据ID
                     var id=rows[i].ID;
                     var rowspan=0;
                     for(var j=0;j<rows.length;j++){
                    
                        if(id==a[j].ID){

          //计算合并多少行
                            rowspan++;
                         
                        }
                     }
                     if(rowspan!=0)
                     {
                     //mergeCells这个方法是合并单元格,index表示标示号就是第几行开始,field表示要合并的字段,rowspan合并行数,colspan:合并列
                         $('#tbList').datagrid('mergeCells',{index:i,field:'ck',rowspan:rowspan});
                         $('#tbList').datagrid('mergeCells',{index:i,field:'ClassName',rowspan:rowspan});
                         i=i+rowspan-1;
                     }
                     }

 

posted on 2013-06-03 10:59  骷髅人  阅读(2064)  评论(1编辑  收藏  举报