-
Notifications
You must be signed in to change notification settings - Fork 0
/
36ajaxing.html
51 lines (51 loc) · 1.79 KB
/
36ajaxing.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
<div style="font-size:12px;">
In 3.6 we have done so that the developer can controll full the ajax requests to the server. For this purpose<br>
we created a 3 level of settings <br/>
1. common ajax settings for all modules that use ajax requests <br/>
2. specific ajax settings for every module<br/>
3. serialize function which can be used to serialize the data to the server in a way that the developer want<br/>
In this example we set the grid to use a POST to the server and in the serialize function we set the things so<br>
that only the first page should be returned<br>
<br />
<table id="jqgajax"></table>
<div id="pjqgajax"></div>
<script src="36ajaxing.js" type="text/javascript"> </script>
<br />
<div style="font-size:12px;">
<b> HTML </b>
<XMP>
<table id="jqgajax"></table>
<div id="jqgajax"></div>
</XMP>
<b>Java Scrpt code</b>
<XMP>
jQuery("#jqgajax").jqGrid({
ajaxGridOptions : {type:"POST"},
serializeGridData : function(postdata) {
postdata.page = 1;
return postdata;
},
url:'server.php?q=2',
datatype: "json",
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[
{name:'id',index:'id', width:55},
{name:'invdate',index:'invdate', width:90},
{name:'name',index:'name asc, invdate', width:100},
{name:'amount',index:'amount', width:80, align:"right"},
{name:'tax',index:'tax', width:80, align:"right"},
{name:'total',index:'total', width:80,align:"right"},
{name:'note',index:'note', width:150, sortable:false}
],
rowNum:10,
width:700,
rowList:[10,20,30],
pager: '#pjqgajax',
sortname: 'invdate',
viewrecords: true,
sortorder: "desc",
caption:"New API Example"
});
jQuery("#pjqgajax").jqGrid('navGrid','#pjqgajax',{edit:false,add:false,del:false});
</XMP>
</div>