zoukankan      html  css  js  c++  java
  • jqgrid 分级标题

    参考地址:http://www.trirand.com/jqgridwiki/doku.php?id=wiki:groupingheadar

    Grouping of the header should be used after the grid is created. For this purpose we have created a method which is called setGroupHeaders

    One typical implementation can look like this

    $(document).ready(function(){
        jQuery("#gridTable").jqGrid({
               colNames: ['Date', 'Client', 'Amount', 'Tax', 'Total', 'Closed', 'Shipped via', 'Notes'],
               colModel: [
                     {name: 'invdate', index: 'invdate',  80, align: 'center', sorttype: 'date',
                        formatter: 'date', formatoptions: {newformat: 'd-M-Y'}, datefmt: 'd-M-Y'},
                     {name: 'name', index: 'name',  70 },
                     {name: 'amount', index: 'amount',  75, formatter: 'number', sorttype: 'number', align: 'right'},
                     {name: 'tax', index: 'tax',  75, formatter: 'number', sorttype: 'number', align: 'right'},
                     {name: 'total', index: 'total',  75, formatter: 'number', sorttype: 'number', align: 'right'},
                     {name: 'closed', index: 'closed',  75, align: 'center', formatter: 'checkbox',
                        edittype: 'checkbox', editoptions: {value: 'Yes:No', defaultValue: 'Yes'}},
                     {name: 'ship_via', index: 'ship_via',  100, align: 'center', formatter: 'select',
                        edittype: 'select', editoptions: {value: 'FE:FedEx;TN:TNT;IN:Intim', defaultValue: 'Intime'}},
                     {name: 'note', index: 'note',  70, sortable: false}
                ],
                rowNum: 10,
                rowList: [5, 10, 20],
            });
        jQuery("#gridTable").jqGrid('setGroupHeaders', {
              useColSpanStyle: false, 
              groupHeaders:[
                {startColumnName: 'amount', numberOfColumns: 3, titleText: '<em>Price</em>'},
                {startColumnName: 'closed', numberOfColumns: 2, titleText: 'Shiping'}
              ]
            });
        jQuery("#gridTable").jqGrid('setGroupHeaders', {
              useColSpanStyle: false, 
              groupHeaders:[
                {startColumnName: 'amount', numberOfColumns: 2, titleText: '<em>Price22</em>'},
                {startColumnName: 'total', numberOfColumns: 1, titleText: 'Shiping2'},
                {startColumnName: 'closed', numberOfColumns: 2, titleText: 'Shiping'}
              ]
            });
    });
  • 相关阅读:
    UVa-129
    UVa-524
    有点迷茫
    北邮之行~
    UVa-253
    心累--期末考试成绩
    UVa-220 Othello
    UVa-201 Squares
    UVA-1589 Xiangqi
    UVa-213 Message Decoding
  • 原文地址:https://www.cnblogs.com/newlangwen/p/5603525.html
Copyright © 2011-2022 走看看