matfish2 / vue-tables-2

Vue.js 2 grid components
https://matanya.gitbook.io/vue-tables-2/
GNU General Public License v3.0
1.53k stars 304 forks source link

After using custom filter, all other filters seem to reset #481

Closed molerat619 closed 6 years ago

molerat619 commented 6 years ago

I have a button that toggles a filter that filters for active/inactive entries. For that, I have to use a requestAdapter. But as soon as I use that filter, the other filters are reset - BUT only in the view. If I check the network tab, the table still sends the right request to the backend. So here is some code:

Options:

initFilters: {
    active: true,
    start_date: {start: moment().subtract(1, 'weeks'), end: moment().add(2, 'weeks')},
    end_date: {start: moment().subtract(1, 'days'), end: moment().add(100, 'years')}
},
requestAdapter: function (data) {
    data.query.active = data.active;
    data.active = undefined;

    return data;
}

HTML:

<div slot="filter__options">
    <button @click="toggleStornoFilter()>Stornos anzeigen</button>
</div>

So again, what happens is that the daterange filters for example stop showing, even though they send the right query to the backend. See these screenshots:

Before clicking "Stornos anzeigen": image

After clicking "Stornos anzeigen": image As you can see, the daterange filters are reset, but now check this request out:

image So it is sending all the right stuff.

Also, in this state, I can no longer click the Daterange Filters to see the picker.

molerat619 commented 6 years ago

I think this has something to do with #484

freeman-g commented 6 years ago

@molerat619 I tried to reproduce your issue, but I wasn't able to in my setup, we're not using server side filters or date filters though.

In our case, we do have some Select based filters and those did remain in place even after the pagination bug from #484. occurred.

matfish2 commented 6 years ago

I think that was fixed by solving #496. Please check and let me know