jqgrid 合并表头
Posted lvlin241
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jqgrid 合并表头相关的知识,希望对你有一定的参考价值。
参考:http://www.trirand.com/jqgridwiki/doku.php?id=wiki:groupingheadar
jQuery("#表格id").jqGrid({
...
colNames: [‘Date‘, ‘Client‘, ‘Amount‘, ‘Tax‘, ‘Total‘, ‘Closed‘, ‘Shipped via‘, ‘Notes‘],
colModel: [
{name: ‘invdate‘, index: ‘invdate‘, width: 80, align: ‘center‘, sorttype: ‘date‘,formatter: ‘date‘, formatoptions: {newformat: ‘d-M-Y‘}, datefmt: ‘d-M-Y‘},
{name: ‘name‘, index: ‘name‘, width: 70 },
{name: ‘amount‘, index: ‘amount‘, width: 75, formatter: ‘number‘, sorttype: ‘number‘, align: ‘right‘},
{name: ‘tax‘, index: ‘tax‘, width: 75, formatter: ‘number‘, sorttype: ‘number‘, align: ‘right‘},
{name: ‘total‘, index: ‘total‘, width: 75, formatter: ‘number‘, sorttype: ‘number‘, align: ‘right‘},
{name: ‘closed‘, index: ‘closed‘, width: 75, align: ‘center‘, formatter: ‘checkbox‘, edittype: ‘checkbox‘, editoptions: {value: ‘Yes:No‘, defaultValue: ‘Yes‘}},
{name: ‘ship_via‘, index: ‘ship_via‘, width: 100, align: ‘center‘, formatter: ‘select‘, edittype: ‘select‘, editoptions: {value: ‘FE:FedEx;TN:TNT;IN:Intim‘, defaultValue: ‘Intime‘}},
{name: ‘note‘, index: ‘note‘, width: 70, sortable: false}
],
rowNum: 10,
rowList: [5, 10, 20],
...
});
jQuery("#表格id").jqGrid(‘setGroupHeaders‘, {
useColSpanStyle: false,
groupHeaders:[
{startColumnName: ‘开始的标题名称‘, numberOfColumns: 合并的表头数量, titleText: ‘<em>合并后的表头名称</em>‘},
{startColumnName: ‘开始的标题名称‘, numberOfColumns: 合并的表头数量, titleText: ‘合并后的表头名称‘}
]
});
以上是关于jqgrid 合并表头的主要内容,如果未能解决你的问题,请参考以下文章