1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-24 23:25:24 +00:00

instances filter stores filter value into cookie and auto-fills/applies filter on document ready

This commit is contained in:
Jan Krcmar 2016-05-06 10:56:50 +02:00
parent 99bd6930b9
commit c4ae3d2982

View file

@ -239,15 +239,22 @@
} }
</script> </script>
<script> <script>
function filter_table() {
var rex = new RegExp($(this).val(), 'i');
$('.searchable tr').hide();
$('.searchable tr').filter(function () {
return rex.test($(this).text());
}).show();
Cookies.set("instances_filter", $(this).val());
}
$(document).ready(function () { $(document).ready(function () {
instances_filter_cookie = Cookies.get("instances_filter");
if (instances_filter_cookie) {
$('#filter').val(instances_filter_cookie);
$('#filter').each(filter_table);
}
(function ($) { (function ($) {
$('#filter').keyup(function () { $('#filter').keyup(filter_table)
var rex = new RegExp($(this).val(), 'i');
$('.searchable tr').hide();
$('.searchable tr').filter(function () {
return rex.test($(this).text());
}).show();
})
}(jQuery)); }(jQuery));
}); });
</script> </script>