Easyui DataGrid Merge Cells

Source: Internet
Author: User
Tags rowcount

Easyui DataGrid Merge Cells

1 functionMergeCells () {2         varArr =[{mergefiled: "Field", Premisefiled: ""}];////Merge column field array and corresponding prerequisites filed (empty is the direct content merge)3         vardg = $ ("#id");//The table ID in the DataGrid to be merged4         varRowCount = Dg.datagrid ("GetRows"). length; 5         varCellname; 6         varspan; 7         varPervalue = ""; 8         varCurvalue = ""; 9         varPercondition= ""; Ten         varCurcondition= "";  One         varflag=true;  A         varCondiname= "";  -         varLength = Arr.length-1;  -          for(i = length; I >= 0; i--) {   theCellname =arr[i].mergefiled;  -Condiname=arr[i].premisefiled;  -             if(!condiname) {   -flag=false;  +             }   -Pervalue = "";  +Percondition= "";  Aspan = 1;  at              for(row = 0; row <= rowCount; row++) {   -                 if(Row = =RowCount) {   -Curvalue = "";  -Curcondition= "";  -}Else {   -Curvalue = Dg.datagrid ("GetRows") [Row][cellname];  in                     /*if (cellname== "Orgstarttime") {//Special handling this time field - curvalue =formatdate (Dg.datagrid ("getRows") [Row][cellname], ""); to                     } */   +                     if(!flag) {   -Curcondition=dg.datagrid ("GetRows") [Row][condiname];  the                     }   *                 }   $                 if(Pervalue = = curvalue&& (flag| | percondition==curcondition)) {  Panax Notoginsengspan + = 1;  -}Else {   the                     varindex = row-span;  +Dg.datagrid (' MergeCells ', {   A Index:index, the Field:cellname, + Rowspan:span, -colspan:NULL   $                     });  $span = 1;  -Pervalue =Curvalue;  -                     if(!flag) {   thepercondition=curcondition;  -                     }  Wuyi                 }   the             }   -         }   Wu     } -  About //<table id= "deviceserieses" class= "Easyui-datagrid" data-options= "Onloadsuccess:mergecells" ></table >

Make column selection in outer table does not change color use the Styler property of the column.

Easyui DataGrid Merge Cells

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.