Lines 246-279
Link Here
|
246 |
[% Asset.js("js/admin-menu.js") | $raw %] |
246 |
[% Asset.js("js/admin-menu.js") | $raw %] |
247 |
[% INCLUDE 'datatables.inc' %] |
247 |
[% INCLUDE 'datatables.inc' %] |
248 |
<script> |
248 |
<script> |
249 |
function filterDataTable( table, column, term ){ |
|
|
250 |
if( column ){ |
251 |
table.column( column ).search( term ).draw(); |
252 |
} else { |
253 |
table.search( term ).draw(); |
254 |
} |
255 |
clearFilter( term ); |
256 |
} |
257 |
|
258 |
function clearFilter( term ){ |
259 |
if( term == "" ){ |
260 |
$(".dt_button_clear_filter").addClass("disabled"); |
261 |
} else { |
262 |
$(".dt_button_clear_filter").removeClass("disabled"); |
263 |
} |
264 |
} |
265 |
|
266 |
$(document).ready(function() { |
249 |
$(document).ready(function() { |
267 |
var crtable = $("#table_cash_registers").kohaTable({ |
250 |
var crtable = $("#table_cash_registers").kohaTable({ |
268 |
columnDefs: [{ targets: [-1, -2], orderable: false, searchable: false }], |
251 |
columnDefs: [{ targets: [-1, -2], orderable: false, searchable: false }], |
269 |
order: [[1, "asc"]], |
252 |
order: [[1, "asc"]], |
270 |
paginationType: "full", |
253 |
paginationType: "full", |
271 |
}); |
254 |
}); |
|
|
255 |
var crtable_dt = crtable.DataTable(); |
272 |
|
256 |
|
273 |
$("#branch_filter").on("change", function(){ |
257 |
$("#branch_filter").on("change", function () { |
274 |
// Table must be filtered by the <option>'s text, not its value |
258 |
// Table must be filtered by the <option>'s text, not its value |
275 |
var opt = $(this).find("option:selected").text(); |
259 |
var opt = $(this).find("option:selected").text(); |
276 |
filterDataTable( crtable, 2, opt ); |
260 |
crtable_dt.column(2).search(opt).draw(); |
277 |
}); |
261 |
}); |
278 |
|
262 |
|
279 |
}); |
263 |
}); |
280 |
- |
|
|