mirror of
https://github.com/retspen/webvirtcloud
synced 2025-07-31 12:41:08 +00:00
Add search in table
This commit is contained in:
parent
5f6b06b467
commit
1e91fb303f
3 changed files with 43 additions and 5 deletions
|
|
@ -80,7 +80,10 @@
|
|||
<h3 class="page-header">{% trans "Volumes" %}</h3>
|
||||
{% if volumes %}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-bordered sortable-theme-bootstrap" data-sortable>
|
||||
<div class="pull-right search">
|
||||
<input id="filter" class="form-control" type="text" placeholder="Search">
|
||||
</div>
|
||||
<table class="table table-striped sortable-theme-bootstrap" data-sortable>
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:35px;">#</th>
|
||||
|
|
@ -90,7 +93,7 @@
|
|||
<th data-sortable="false" colspan="2">{% trans "Action" %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tbody class="searchable">
|
||||
{% for volume in volumes %}
|
||||
<tr>
|
||||
<td>{{ forloop.counter }}</td>
|
||||
|
|
@ -202,4 +205,17 @@
|
|||
}
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
(function ($) {
|
||||
$('#filter').keyup(function () {
|
||||
var rex = new RegExp($(this).val(), 'i');
|
||||
$('.searchable tr').hide();
|
||||
$('.searchable tr').filter(function () {
|
||||
return rex.test($(this).text());
|
||||
}).show();
|
||||
})
|
||||
}(jQuery));
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue