-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverSide.html
166 lines (118 loc) · 5.32 KB
/
serverSide.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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="shortcut icon" type="image/ico" href="http://www.sprymedia.co.uk/media/images/favicon.ico">
<title>Using DataTable with column filter plugin - Server Side Example</title>
<style type="text/css" title="currentStyle">
@import "media/css/demo_page.css";
@import "media/css/demo_table.css";
@import "media/css/themes/base/jquery-ui.css";
@import "media/css/themes/smoothness/jquery-ui-1.7.2.custom.css";
</style>
<script src="media/js/jquery-1.4.4.min.js" type="text/javascript"></script>
<script src="media/js/jquery.dataTables.js" type="text/javascript"></script>
<script src="media/js/jquery-ui.js" type="text/javascript"></script>
<script src="media/js/jquery.dataTables.columnFilter.js" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready( function () {
$('#example').dataTable({
"bProcessing": true,
"bServerSide": true,
//"sAjaxSource": "server_processing.js"
"sAjaxSource": "http://datatables.net/release-datatables/examples/server_side/scripts/jsonp.php",
"fnServerData": function( sUrl, aoData, fnCallback ) {
$.ajax( {
"url": sUrl,
"data": aoData,
"success": fnCallback,
"dataType": "jsonp",
"cache": false
} );
}
}
).columnFilter({
aoColumns: [ { type: "select", values: [ 'Gecko', 'Trident "New"', 'Trident', 'KHTML', 'Misc', 'Presto', 'Webkit', 'Tasman'] },
{ type: "text" },
{ type: "text" },
{ type: "text" }
]
});
} );
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-17838786-4']);
_gaq.push(['_trackPageview']);
(function () {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body id="dt_example">
<div id="container">
<a href="index.html">Home</a>
<a href="http://code.google.com/p/jquery-datatables-column-filter/wiki/ColumnFilter">Wiki</a>
<div class="full_width big">
JQuery DataTable Column Filter - Server Side Example
</div>
<h1>Preamble</h1>
<p>
DataTables ColumnFilter add-in works in the Server-side mode. Live example below is configured to use server-side
processing code. On the live demo site is used JSONP processing because live server processing page is placed on the DataTables site.
</p>
<p>
Note that in the server-side mode you must define values for the select list in the dropdown - autobuild will not work because
in the column are not placed all values that can be used for filtering. Also, if you put the range filters in the columns you
start and end values will be sent in the start~end format. You will need to parse it on the server-side and return filtered
informaiton back to plugin.
</p>
<h1>Live example</h1>
<div id="demo">
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
<thead>
<tr>
<th>Rendering engine</th>
<th>Browser</th>
<th>Platform(s)</th>
<th>Engine version</th>
<th>CSS grade</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Rendering engine</th>
<th>Browser</th>
<th>Platform(s)</th>
<th>Engine version</th>
<th>CSS grade</th>
</tr>
</tfoot>
<tbody>
</tbody>
</table>
</div>
<div class="spacer"></div>
<h1>Initialization code</h1>
<p>There are no additional settings here - if you set-up dataTables in the server-side processing mode, filter requests will just be redirected to the server-side.</p>
<h1>Other examples</h1>
<ul>
<li><a href="default.html">Basic usage</a></li>
<li><a href="customFilters.html">Custom filters</a></li>
<li><a href="dateRange.html">Date ranges</a></li>
<li><a href="numberRange.html">Number ranges</a></li>
<li><a href="ajaxSource.html">Ajax source filtering</a></li>
<li><a href="serverSide.html">Server-side filtering</a></li>
<li><a href="regex.html">Regular expression filtering</a></li>
<li><a href="external.html">Filtering via external form</a></li>
</ul>
<div id="footer" style="text-align:center;">
<span style="font-size:10px;">
DataTables Column Filter Add-on © Jovan Popovic 2011.<br>
DataTables designed and created by <a href="http://www.sprymedia.co.uk">Allan Jardine</a> © 2007-2011<br>
</span>
</div>
</div>
</body>
</html>