Sha256: e7b01b833d6082ff6f1e3850a2827e1e5f68affd58d5c87d6c0cde99f71ebce2
Contents?: true
Size: 1.04 KB
Versions: 21
Compression:
Stored size: 1.04 KB
Contents
(function(Modules) { "use strict"; Modules.FilterableTable = function() { var that = this; that.start = function(element) { var rows = element.find('tbody tr'), tableInput = element.find('.js-filter-table-input'); element.on('keyup change', '.js-filter-table-input', filterTableBasedOnInput); if (element.find('a.js-open-on-submit').length > 0) { element.on('submit', 'form', openFirstVisibleLink); } function filterTableBasedOnInput(event) { var searchString = $.trim(tableInput.val()), regExp = new RegExp(searchString, 'i'); rows.each(function() { var row = $(this); if (row.text().search(regExp) > -1) { row.show(); } else { row.hide(); } }); } function openFirstVisibleLink(evt) { evt.preventDefault(); var link = element.find('a.js-open-on-submit:visible').first(); GOVUKAdmin.redirect(link.attr('href')); } } }; })(window.GOVUKAdmin.Modules);
Version data entries
21 entries across 21 versions & 1 rubygems