123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- $(document).ready(function() {
- var activeSystemClass = $('.list-group-item.active');
- //something is entered in search form
- $('#system-search').keyup( function() {
- var that = this;
- // affect all table rows on in systems table
- var tableBody = $('.table-list-search tbody');
- var tableRowsClass = $('.table-list-search tbody tr');
- $('.search-sf').remove();
- tableRowsClass.each( function(i, val) {
-
- //Lower text for case insensitive
- var rowText = $(val).text().toLowerCase();
- var inputText = $(that).val().toLowerCase();
- if(inputText != '')
- {
- $('.search-query-sf').remove();
- tableBody.prepend('<tr class="search-query-sf"><td colspan="6" <div class="alert alert-info">Einträge mit <strong>"'
- + $(that).val()
- + '"</strong></div></td></tr>');
- }
- else
- {
- $('.search-query-sf').remove();
- }
- if( rowText.indexOf( inputText ) == -1 )
- {
- //hide rows
- tableRowsClass.eq(i).hide();
-
- }
- else
- {
- $('.search-sf').remove();
- tableRowsClass.eq(i).show();
- }
- });
- //all tr elements are hidden
- if(tableRowsClass.children(':visible').length == 0)
- {
- tableBody.append('<tr class="search-sf"><td class="text-muted" colspan="6">Kein Eintrag gefunden.</td></tr>');
- }
- });
- });
-
|