| 9 |
lars |
1 |
var TableDatatablesResponsive = function () {
|
|
|
2 |
|
|
|
3 |
var initTable1 = function () {
|
|
|
4 |
var table = $('#sample_1');
|
|
|
5 |
|
|
|
6 |
var oTable = table.dataTable({
|
|
|
7 |
// Internationalisation. For more info refer to http://datatables.net/manual/i18n
|
|
|
8 |
"language": {
|
|
|
9 |
"aria": {
|
|
|
10 |
"sortAscending": ": activate to sort column ascending",
|
|
|
11 |
"sortDescending": ": activate to sort column descending"
|
|
|
12 |
},
|
|
|
13 |
"emptyTable": "No data available in table",
|
|
|
14 |
"info": "Showing _START_ to _END_ of _TOTAL_ entries",
|
|
|
15 |
"infoEmpty": "No entries found",
|
|
|
16 |
"infoFiltered": "(filtered1 from _MAX_ total entries)",
|
|
|
17 |
"lengthMenu": "_MENU_ entries",
|
|
|
18 |
"search": "Search:",
|
|
|
19 |
"zeroRecords": "No matching records found"
|
|
|
20 |
},
|
|
|
21 |
|
|
|
22 |
// Or you can use remote translation file
|
|
|
23 |
//"language": {
|
|
|
24 |
// url: '//cdn.datatables.net/plug-ins/3cfcc339e89/i18n/Portuguese.json'
|
|
|
25 |
//},
|
|
|
26 |
|
|
|
27 |
// setup buttons extentension: http://datatables.net/extensions/buttons/
|
|
|
28 |
buttons: [
|
|
|
29 |
{ extend: 'print', className: 'btn dark btn-outline' },
|
|
|
30 |
{ extend: 'pdf', className: 'btn green btn-outline' },
|
|
|
31 |
{ extend: 'csv', className: 'btn purple btn-outline ' }
|
|
|
32 |
],
|
|
|
33 |
|
|
|
34 |
// setup responsive extension: http://datatables.net/extensions/responsive/
|
|
|
35 |
responsive: {
|
|
|
36 |
details: {
|
|
|
37 |
|
|
|
38 |
}
|
|
|
39 |
},
|
|
|
40 |
|
|
|
41 |
"order": [
|
|
|
42 |
[0, 'asc']
|
|
|
43 |
],
|
|
|
44 |
|
|
|
45 |
"lengthMenu": [
|
|
|
46 |
[5, 10, 15, 20, -1],
|
|
|
47 |
[5, 10, 15, 20, "All"] // change per page values here
|
|
|
48 |
],
|
|
|
49 |
// set the initial value
|
|
|
50 |
"pageLength": 10,
|
|
|
51 |
|
|
|
52 |
"dom": "<'row' <'col-md-12'B>><'row'<'col-md-6 col-sm-12'l><'col-md-6 col-sm-12'f>r><'table-scrollable't><'row'<'col-md-5 col-sm-12'i><'col-md-7 col-sm-12'p>>", // horizobtal scrollable datatable
|
|
|
53 |
|
|
|
54 |
// Uncomment below line("dom" parameter) to fix the dropdown overflow issue in the datatable cells. The default datatable layout
|
|
|
55 |
// setup uses scrollable div(table-scrollable) with overflow:auto to enable vertical scroll(see: assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.js).
|
|
|
56 |
// So when dropdowns used the scrollable div should be removed.
|
|
|
57 |
//"dom": "<'row' <'col-md-12'T>><'row'<'col-md-6 col-sm-12'l><'col-md-6 col-sm-12'f>r>t<'row'<'col-md-5 col-sm-12'i><'col-md-7 col-sm-12'p>>",
|
|
|
58 |
});
|
|
|
59 |
}
|
|
|
60 |
|
|
|
61 |
var initTable2 = function () {
|
|
|
62 |
var table = $('#sample_2');
|
|
|
63 |
|
|
|
64 |
var oTable = table.dataTable({
|
|
|
65 |
// Internationalisation. For more info refer to http://datatables.net/manual/i18n
|
|
|
66 |
"language": {
|
|
|
67 |
"aria": {
|
|
|
68 |
"sortAscending": ": activate to sort column ascending",
|
|
|
69 |
"sortDescending": ": activate to sort column descending"
|
|
|
70 |
},
|
|
|
71 |
"emptyTable": "No data available in table",
|
|
|
72 |
"info": "Showing _START_ to _END_ of _TOTAL_ entries",
|
|
|
73 |
"infoEmpty": "No entries found",
|
|
|
74 |
"infoFiltered": "(filtered1 from _MAX_ total entries)",
|
|
|
75 |
"lengthMenu": "_MENU_ entries",
|
|
|
76 |
"search": "Search:",
|
|
|
77 |
"zeroRecords": "No matching records found"
|
|
|
78 |
},
|
|
|
79 |
|
|
|
80 |
// Or you can use remote translation file
|
|
|
81 |
//"language": {
|
|
|
82 |
// url: '//cdn.datatables.net/plug-ins/3cfcc339e89/i18n/Portuguese.json'
|
|
|
83 |
//},
|
|
|
84 |
|
|
|
85 |
// setup buttons extentension: http://datatables.net/extensions/buttons/
|
|
|
86 |
buttons: [
|
|
|
87 |
{ extend: 'print', className: 'btn dark btn-outline' },
|
|
|
88 |
{ extend: 'pdf', className: 'btn green btn-outline' },
|
|
|
89 |
{ extend: 'csv', className: 'btn purple btn-outline ' }
|
|
|
90 |
],
|
|
|
91 |
|
|
|
92 |
// setup responsive extension: http://datatables.net/extensions/responsive/
|
|
|
93 |
responsive: {
|
|
|
94 |
details: {
|
|
|
95 |
type: 'column',
|
|
|
96 |
target: 'tr'
|
|
|
97 |
}
|
|
|
98 |
},
|
|
|
99 |
columnDefs: [ {
|
|
|
100 |
className: 'control',
|
|
|
101 |
orderable: false,
|
|
|
102 |
targets: 0
|
|
|
103 |
} ],
|
|
|
104 |
|
|
|
105 |
order: [ 1, 'asc' ],
|
|
|
106 |
|
|
|
107 |
// pagination control
|
|
|
108 |
"lengthMenu": [
|
|
|
109 |
[5, 10, 15, 20, -1],
|
|
|
110 |
[5, 10, 15, 20, "All"] // change per page values here
|
|
|
111 |
],
|
|
|
112 |
// set the initial value
|
|
|
113 |
"pageLength": 10,
|
|
|
114 |
"pagingType": 'bootstrap_extended', // pagination type
|
|
|
115 |
|
|
|
116 |
"dom": "<'row' <'col-md-12'B>><'row'<'col-md-6 col-sm-12'l><'col-md-6 col-sm-12'f>r><'table-scrollable't><'row'<'col-md-5 col-sm-12'i><'col-md-7 col-sm-12'p>>", // horizobtal scrollable datatable
|
|
|
117 |
|
|
|
118 |
// Uncomment below line("dom" parameter) to fix the dropdown overflow issue in the datatable cells. The default datatable layout
|
|
|
119 |
// setup uses scrollable div(table-scrollable) with overflow:auto to enable vertical scroll(see: assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.js).
|
|
|
120 |
// So when dropdowns used the scrollable div should be removed.
|
|
|
121 |
//"dom": "<'row' <'col-md-12'T>><'row'<'col-md-6 col-sm-12'l><'col-md-6 col-sm-12'f>r>t<'row'<'col-md-5 col-sm-12'i><'col-md-7 col-sm-12'p>>",
|
|
|
122 |
});
|
|
|
123 |
}
|
|
|
124 |
|
|
|
125 |
var initTable3 = function () {
|
|
|
126 |
var table = $('#sample_3');
|
|
|
127 |
|
|
|
128 |
var oTable = table.dataTable({
|
|
|
129 |
// Internationalisation. For more info refer to http://datatables.net/manual/i18n
|
|
|
130 |
"language": {
|
|
|
131 |
"aria": {
|
|
|
132 |
"sortAscending": ": activate to sort column ascending",
|
|
|
133 |
"sortDescending": ": activate to sort column descending"
|
|
|
134 |
},
|
|
|
135 |
"emptyTable": "No data available in table",
|
|
|
136 |
"info": "Showing _START_ to _END_ of _TOTAL_ entries",
|
|
|
137 |
"infoEmpty": "No entries found",
|
|
|
138 |
"infoFiltered": "(filtered1 from _MAX_ total entries)",
|
|
|
139 |
"lengthMenu": "_MENU_ entries",
|
|
|
140 |
"search": "Search:",
|
|
|
141 |
"zeroRecords": "No matching records found"
|
|
|
142 |
},
|
|
|
143 |
|
|
|
144 |
// Or you can use remote translation file
|
|
|
145 |
//"language": {
|
|
|
146 |
// url: '//cdn.datatables.net/plug-ins/3cfcc339e89/i18n/Portuguese.json'
|
|
|
147 |
//},
|
|
|
148 |
|
|
|
149 |
// setup buttons extentension: http://datatables.net/extensions/buttons/
|
|
|
150 |
buttons: [
|
|
|
151 |
{ extend: 'print', className: 'btn default' },
|
|
|
152 |
{ extend: 'pdf', className: 'btn default' },
|
|
|
153 |
{ extend: 'csv', className: 'btn default' }
|
|
|
154 |
],
|
|
|
155 |
|
|
|
156 |
// setup responsive extension: http://datatables.net/extensions/responsive/
|
|
|
157 |
responsive: {
|
|
|
158 |
details: {
|
|
|
159 |
|
|
|
160 |
}
|
|
|
161 |
},
|
|
|
162 |
|
|
|
163 |
"order": [
|
|
|
164 |
[0, 'asc']
|
|
|
165 |
],
|
|
|
166 |
|
|
|
167 |
"lengthMenu": [
|
|
|
168 |
[5, 10, 15, 20, -1],
|
|
|
169 |
[5, 10, 15, 20, "All"] // change per page values here
|
|
|
170 |
],
|
|
|
171 |
// set the initial value
|
|
|
172 |
"pageLength": 10,
|
|
|
173 |
|
|
|
174 |
"dom": "<'row' <'col-md-12'B>><'row'<'col-md-6 col-sm-12'l><'col-md-6 col-sm-12'f>r><'table-scrollable't><'row'<'col-md-5 col-sm-12'i><'col-md-7 col-sm-12'p>>", // horizobtal scrollable datatable
|
|
|
175 |
|
|
|
176 |
// Uncomment below line("dom" parameter) to fix the dropdown overflow issue in the datatable cells. The default datatable layout
|
|
|
177 |
// setup uses scrollable div(table-scrollable) with overflow:auto to enable vertical scroll(see: assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.js).
|
|
|
178 |
// So when dropdowns used the scrollable div should be removed.
|
|
|
179 |
//"dom": "<'row' <'col-md-12'T>><'row'<'col-md-6 col-sm-12'l><'col-md-6 col-sm-12'f>r>t<'row'<'col-md-5 col-sm-12'i><'col-md-7 col-sm-12'p>>",
|
|
|
180 |
});
|
|
|
181 |
}
|
|
|
182 |
|
|
|
183 |
var initTable4 = function () {
|
|
|
184 |
var table = $('#sample_4');
|
|
|
185 |
|
|
|
186 |
var oTable = table.dataTable({
|
|
|
187 |
// Internationalisation. For more info refer to http://datatables.net/manual/i18n
|
|
|
188 |
"language": {
|
|
|
189 |
"aria": {
|
|
|
190 |
"sortAscending": ": activate to sort column ascending",
|
|
|
191 |
"sortDescending": ": activate to sort column descending"
|
|
|
192 |
},
|
|
|
193 |
"emptyTable": "No data available in table",
|
|
|
194 |
"info": "Showing _START_ to _END_ of _TOTAL_ entries",
|
|
|
195 |
"infoEmpty": "No entries found",
|
|
|
196 |
"infoFiltered": "(filtered1 from _MAX_ total entries)",
|
|
|
197 |
"lengthMenu": "_MENU_ entries",
|
|
|
198 |
"search": "Search:",
|
|
|
199 |
"zeroRecords": "No matching records found"
|
|
|
200 |
},
|
|
|
201 |
|
|
|
202 |
// Or you can use remote translation file
|
|
|
203 |
//"language": {
|
|
|
204 |
// url: '//cdn.datatables.net/plug-ins/3cfcc339e89/i18n/Portuguese.json'
|
|
|
205 |
//},
|
|
|
206 |
|
|
|
207 |
// setup buttons extentension: http://datatables.net/extensions/buttons/
|
|
|
208 |
buttons: [
|
|
|
209 |
{ extend: 'print', className: 'btn default' },
|
|
|
210 |
{ extend: 'pdf', className: 'btn default' },
|
|
|
211 |
{ extend: 'csv', className: 'btn default' }
|
|
|
212 |
],
|
|
|
213 |
|
|
|
214 |
// setup responsive extension: http://datatables.net/extensions/responsive/
|
|
|
215 |
responsive: {
|
|
|
216 |
details: {
|
|
|
217 |
|
|
|
218 |
}
|
|
|
219 |
},
|
|
|
220 |
|
|
|
221 |
"order": [
|
|
|
222 |
[0, 'asc']
|
|
|
223 |
],
|
|
|
224 |
|
|
|
225 |
"lengthMenu": [
|
|
|
226 |
[5, 10, 15, 20, -1],
|
|
|
227 |
[5, 10, 15, 20, "All"] // change per page values here
|
|
|
228 |
],
|
|
|
229 |
// set the initial value
|
|
|
230 |
"pageLength": 10,
|
|
|
231 |
|
|
|
232 |
"dom": "<'row' <'col-md-12'B>><'row'<'col-md-6 col-sm-12'l><'col-md-6 col-sm-12'f>r><'table-scrollable't><'row'<'col-md-5 col-sm-12'i><'col-md-7 col-sm-12'p>>", // horizobtal scrollable datatable
|
|
|
233 |
|
|
|
234 |
// Uncomment below line("dom" parameter) to fix the dropdown overflow issue in the datatable cells. The default datatable layout
|
|
|
235 |
// setup uses scrollable div(table-scrollable) with overflow:auto to enable vertical scroll(see: assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.js).
|
|
|
236 |
// So when dropdowns used the scrollable div should be removed.
|
|
|
237 |
//"dom": "<'row' <'col-md-12'T>><'row'<'col-md-6 col-sm-12'l><'col-md-6 col-sm-12'f>r>t<'row'<'col-md-5 col-sm-12'i><'col-md-7 col-sm-12'p>>",
|
|
|
238 |
});
|
|
|
239 |
}
|
|
|
240 |
|
|
|
241 |
|
|
|
242 |
return {
|
|
|
243 |
|
|
|
244 |
//main function to initiate the module
|
|
|
245 |
init: function () {
|
|
|
246 |
|
|
|
247 |
if (!jQuery().dataTable) {
|
|
|
248 |
return;
|
|
|
249 |
}
|
|
|
250 |
|
|
|
251 |
initTable1();
|
|
|
252 |
initTable2();
|
|
|
253 |
initTable3();
|
|
|
254 |
initTable4();
|
|
|
255 |
}
|
|
|
256 |
|
|
|
257 |
};
|
|
|
258 |
|
|
|
259 |
}();
|
|
|
260 |
|
|
|
261 |
jQuery(document).ready(function() {
|
|
|
262 |
TableDatatablesResponsive.init();
|
|
|
263 |
});
|