From 05be1e862f3e38187aaebd9909e78649078b1016 Mon Sep 17 00:00:00 2001 From: Luka Murn Date: Tue, 10 Jan 2017 11:26:12 +0100 Subject: [PATCH] Update filter after toggling visibility (if neccesary) --- app/assets/javascripts/samples/sample_datatable.js.erb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/assets/javascripts/samples/sample_datatable.js.erb b/app/assets/javascripts/samples/sample_datatable.js.erb index f927323f9..b918ae7f7 100644 --- a/app/assets/javascripts/samples/sample_datatable.js.erb +++ b/app/assets/javascripts/samples/sample_datatable.js.erb @@ -1044,6 +1044,12 @@ function changeToEditMode() { column.visible(true); table.setColumnSearchable(column.index(), true); } + + // Re-filter/search if neccesary + var searchText = $('div.dataTables_filter input').val(); + if (!_.isEmpty(searchText)) { + table.search(searchText).draw(); + } }); }