-
Notifications
You must be signed in to change notification settings - Fork 0
/
38remote4.html
78 lines (77 loc) · 2.38 KB
/
38remote4.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<div style="font-size:12px;">
This example demonstartes some usefull methods like changing the group dynamically, remove grouping and etc.<br/>
<br/><br/>
</div>
Group By: <select id="chngroup">
<option value="name">Client name</option>
<option value="invdate">Invoice Date</option>
<option value="clear">Remove Grouping</option>
</select>
<br />
<br />
<table id="48remote4"></table>
<div id="p48remote4"></div>
<script src="38remote4.js" type="text/javascript"></script>
<br />
<div style="font-size:12px;">
<b> HTML </b>
<XMP>
...
Group By: <select id="chngroup">
<option value="name">Client name</option>
<option value="invdate">Invoice Date</option>
<option value="clear">Remove Grouping</option>
</select>
<br />
<br />
<table id="48remote4"></table>
<div id="p48remote4"></div>
</XMP>
<b>Java Scrpt code</b>
<XMP>
jQuery("#48remote4").jqGrid({
url:'server.php?q=2',
datatype: "json",
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[
{name:'id',index:'id', width:55, editable:true, sorttype:'int',summaryType:'count', summaryTpl : '({0}) total'},
{name:'invdate',index:'invdate', width:90, sorttype:'date', formatter:'date', datefmt:'d/m/Y'},
{name:'name',index:'name', width:100},
{name:'amount',index:'amount', width:80, align:"right", sorttype:'number',formatter:'number',summaryType:'sum'},
{name:'tax',index:'tax', width:80, align:"right",sorttype:'number',formatter:'number',summaryType:'sum'},
{name:'total',index:'total', width:80,align:"right",sorttype:'number',formatter:'number', summaryType:'sum'},
{name:'note',index:'note', width:150, sortable:false,editable:true}
],
rowNum:10,
rowList:[10,20,30],
height: 'auto',
pager: '#p48remote4',
sortname: 'invdate',
viewrecords: true,
sortorder: "desc",
caption:"Dynamically changing the grouping",
grouping: true,
groupingView : {
groupField : ['name'],
groupColumnShow : [true],
groupText : ['<b>{0}</b>'],
groupCollapse : false,
groupOrder: ['asc'],
groupSummary : [true],
groupDataSorted : true
},
footerrow: true,
userDataOnFooter: true
});
jQuery("#chngroup").change(function(){
var vl = $(this).val();
if(vl) {
if(vl == "clear") {
jQuery("#48remote4").jqGrid('groupingRemove',true);
} else {
jQuery("#48remote4").jqGrid('groupingGroupBy',vl);
}
}
});
</XMP>
</div>