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
// test.js
$(document).ready(function() {

    jQuery("#mytable").jqGrid({
        scroll: 1,
        url:'http://www.trirand.com/jqgrid/server.php?q=2',
        datatype: "json",
        height: 255,
        width: 600,
        colNames:['Index','Name', 'Code'],
        colModel:[
            {
                name:'item_id',
                index:'item_id',
                width:65
            },
            {
                name:'item',
                index:'item',
                width:150
            },
            {
                name:'item_cd',
                index:'item_cd',
                width:100
            }
        ],
        rowNum:100,
        mtype: "GET",
        rownumbers: true,
        rownumWidth: 40,
        gridview: true,
        pager: '#mypager',
        sortname: 'item_id',
        viewrecords: true,
        sortorder: "asc",
        caption: "Loading data while scrolling"
    });


    $("a").click(function() {
        result = $("#mytable").jqGridExport({
            exptype : "jsonstring"
        });
        $("#export_results").text(result);
        return false;
    });


});