app/assets/javascripts/tabulatr/application.js in tabulatr2-0.8.2 vs app/assets/javascripts/tabulatr/application.js in tabulatr2-0.8.3

- old
+ new

@@ -191,10 +191,19 @@ makeAction: function(action, data){ Tabulatr.currentData = data; return unescape(action).replace(/{{([\w:]+)}}/g, Tabulatr.replacer); }, + submitFilterForm: function(tableId){ + if($('.pagination[data-table='+ tableId +']').length == 0){ + $('.pagination_trigger[data-table='+ tableId +']').unbind('inview', cbfn); + $('.pagination_trigger[data-table='+ tableId +']').bind('inview', cbfn); + } + Tabulatr.updateTable({page: 1, append: false}, tableId, true); + return false; + }, + createParameterString: function(hash, tableId){ var tableName = tableId.split('_')[0]; if(hash === undefined){ hash = {}; hash.append = false; @@ -297,15 +306,11 @@ return false; }); $('form.tabulatr_filter_form').submit(function(ev){ var tableId = $(this).data('table'); - if($('.pagination[data-table='+ tableId +']').length == 0){ - $('.pagination_trigger[data-table='+ tableId +']').unbind('inview', cbfn); - $('.pagination_trigger[data-table='+ tableId +']').bind('inview', cbfn); - } - Tabulatr.updateTable({page: 1, append: false}, tableId, true); + Tabulatr.submitFilterForm(tableId); return false; }); $('.tabulatr_table').on('click', 'i.tabulatr_remove_filter', function(){ var $th = $(this).closest('th'); @@ -431,17 +436,19 @@ t.hide('blind'); t.find('input[type=text]').val(""); $('a[data-show-table-filter="'+nam+'"]').show(); if ($('div[data-filter-column-name]:visible').length <= 2) $('div[data-filter-column-name="_submit"]').hide('blind'); + + var tableId = $(this).parents('form').data('table'); + Tabulatr.submitFilterForm(tableId); return false; }) $(document).on('change', 'select[data-tabulatr-date-filter]', function() { var select = $(this); var option = select.find('option:selected'); var val = option.val(); - console.log(val); if (val === 'from_to') { select.parents('.controls').find(".from_to").show().removeClass('hidden'); } else { select.parents('.controls').find(".from_to").hide().val(''); }