-
Notifications
You must be signed in to change notification settings - Fork 0
/
jq_grid.html
205 lines (147 loc) · 9.33 KB
/
jq_grid.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<link href="css/plugins/jQueryUI/jquery-ui-1.10.4.custom.min.css" rel="stylesheet">
<link href="css/plugins/jqGrid/ui.jqgrid.css" rel="stylesheet">
<style>
/* Additional style to fix warning dialog position */
#alertmod_table_list_2 {
top: 900px !important;
}
</style>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
<div class="col-lg-12">
<div class="ibox ">
<div class="ibox-title">
<h5>jQuery Grid Plugin – jqGrid</h5>
</div>
<div class="ibox-content">
<p>
<strong>jqGrid</strong> is an Ajax-enabled JavaScript control that provides solutions for representing and manipulating tabular data on the web. Since the grid is a client-side solution loading data dynamically through Ajax callbacks, it can be integrated with any server-side technology, including PHP, ASP, Java Servlets, JSP, ColdFusion, and Perl.
jqGrid uses a jQuery Java Script Library and is written as plugin for that package. For more information on jQuery Grid, please refer to the <a target="_blank" href="http://www.trirand.com/blog/"> jqGrid web site.</a>
</p>
<h4>Basic example</h4>
<div class="jqGrid_wrapper">
<table id="table_list_1"></table>
<div id="pager_list_1"></div>
</div>
<h4>Advanced example</h4>
<p>
</p>
<div class="jqGrid_wrapper">
<table id="table_list_2"></table>
<div id="pager_list_2"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Mainly scripts -->
<!-- Peity -->
<!-- jqGrid -->
<script src="js/plugins/jqGrid/i18n/grid.locale-en.js"></script>
<script src="js/plugins/jqGrid/jquery.jqGrid.min.js"></script>
<!-- Custom and plugin javascript -->
<script src="js/common.js"></script>
<script src="js/plugins/jquery-ui/jquery-ui.min.js"></script>
<script>
$(document).ready(function () {
// Examle data for jqGrid
var mydata = [
{id: "1", invdate: "2010-05-24", name: "test", note: "note", tax: "10.00", total: "2111.00"} ,
{id: "2", invdate: "2010-05-25", name: "test2", note: "note2", tax: "20.00", total: "320.00"},
{id: "3", invdate: "2007-09-01", name: "test3", note: "note3", tax: "30.00", total: "430.00"},
{id: "4", invdate: "2007-10-04", name: "test", note: "note", tax: "10.00", total: "210.00"},
{id: "5", invdate: "2007-10-05", name: "test2", note: "note2", tax: "20.00", total: "320.00"},
{id: "6", invdate: "2007-09-06", name: "test3", note: "note3", tax: "30.00", total: "430.00"},
{id: "7", invdate: "2007-10-04", name: "test", note: "note", tax: "10.00", total: "210.00"},
{id: "8", invdate: "2007-10-03", name: "test2", note: "note2", amount: "300.00", tax: "21.00", total: "320.00"},
{id: "9", invdate: "2007-09-01", name: "test3", note: "note3", amount: "400.00", tax: "30.00", total: "430.00"},
{id: "11", invdate: "2007-10-01", name: "test", note: "note", amount: "200.00", tax: "10.00", total: "210.00"},
{id: "12", invdate: "2007-10-02", name: "test2", note: "note2", amount: "300.00", tax: "20.00", total: "320.00"},
{id: "13", invdate: "2007-09-01", name: "test3", note: "note3", amount: "400.00", tax: "30.00", total: "430.00"},
{id: "14", invdate: "2007-10-04", name: "test", note: "note", amount: "200.00", tax: "10.00", total: "210.00"},
{id: "15", invdate: "2007-10-05", name: "test2", note: "note2", amount: "300.00", tax: "20.00", total: "320.00"},
{id: "16", invdate: "2007-09-06", name: "test3", note: "note3", amount: "400.00", tax: "30.00", total: "430.00"},
{id: "17", invdate: "2007-10-04", name: "test", note: "note", amount: "200.00", tax: "10.00", total: "210.00"},
{id: "18", invdate: "2007-10-03", name: "test2", note: "note2", amount: "300.00", tax: "20.00", total: "320.00"},
{id: "19", invdate: "2007-09-01", name: "test3", note: "note3", amount: "400.00", tax: "30.00", total: "430.00"},
{id: "21", invdate: "2007-10-01", name: "test", note: "note", amount: "200.00", tax: "10.00", total: "210.00"},
{id: "22", invdate: "2007-10-02", name: "test2", note: "note2", amount: "300.00", tax: "20.00", total: "320.00"},
{id: "23", invdate: "2007-09-01", name: "test3", note: "note3", amount: "400.00", tax: "30.00", total: "430.00"},
{id: "24", invdate: "2007-10-04", name: "test", note: "note", amount: "200.00", tax: "10.00", total: "210.00"},
{id: "25", invdate: "2007-10-05", name: "test2", note: "note2", amount: "300.00", tax: "20.00", total: "320.00"},
{id: "26", invdate: "2007-09-06", name: "test3", note: "note3", amount: "400.00", tax: "30.00", total: "430.00"},
{id: "27", invdate: "2007-10-04", name: "test", note: "note", amount: "200.00", tax: "10.00", total: "210.00"},
{id: "28", invdate: "2007-10-03", name: "test2", note: "note2", amount: "300.00", tax: "20.00", total: "320.00"},
{id: "29", invdate: "2007-09-01", name: "test3", note: "note3", amount: "400.00", tax: "30.00", total: "430.00"}
];
// Configuration for jqGrid Example 1
$("#table_list_1").jqGrid({
data: mydata,
datatype: "local",
height: 250,
autowidth: true,
shrinkToFit: true,
rowNum: 14,
rowList: [10, 20, 30],
colNames: ['Inv No', 'Date', 'Client', 'Amount', 'Tax', 'Total', 'Notes'],
colModel: [
{name: 'id', index: 'id', width: 60, sorttype: "int"},
{name: 'invdate', index: 'invdate', width: 90, sorttype: "date", formatter: "date"},
{name: 'name', index: 'name', width: 100},
{name: 'amount', index: 'amount', width: 80, align: "right", sorttype: "float", formatter: "number"},
{name: 'tax', index: 'tax', width: 80, align: "right", sorttype: "float"},
{name: 'total', index: 'total', width: 80, align: "right", sorttype: "float"},
{name: 'note', index: 'note', width: 150, sortable: false}
],
pager: "#pager_list_1",
viewrecords: true,
caption: "Example jqGrid 1",
hidegrid: false
});
// Configuration for jqGrid Example 2
$("#table_list_2").jqGrid({
data: mydata,
datatype: "local",
height: 450,
autowidth: true,
shrinkToFit: true,
rowNum: 20,
rowList: [10, 20, 30],
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[
{name:'id',index:'id', editable: true, width:60, sorttype:"int",search:true},
{name:'invdate',index:'invdate', editable: true, width:90, sorttype:"date", formatter:"date"},
{name:'name',index:'name', editable: true, width:100},
{name:'amount',index:'amount', editable: true, width:80, align:"right",sorttype:"float", formatter:"number"},
{name:'tax',index:'tax', editable: true, width:80, align:"right",sorttype:"float"},
{name:'total',index:'total', editable: true, width:80,align:"right",sorttype:"float"},
{name:'note',index:'note', editable: true, width:100, sortable:false}
],
pager: "#pager_list_2",
viewrecords: true,
caption: "Example jqGrid 2",
add: true,
edit: true,
addtext: 'Add',
edittext: 'Edit',
hidegrid: false
});
// Add selection
$("#table_list_2").setSelection(4, true);
// Setup buttons
$("#table_list_2").jqGrid('navGrid', '#pager_list_2',
{edit: true, add: true, del: true, search: true},
{height: 200, reloadAfterSubmit: true}
);
// Add responsive to jqGrid
$(window).bind('resize', function () {
var width = $('.jqGrid_wrapper').width();
$('#table_list_1').setGridWidth(width);
$('#table_list_2').setGridWidth(width);
});
setTimeout(function(){
$('.wrapper-content').removeClass('animated fadeInRight');
},700);
});
</script>