Closed knobik closed 2 years ago
Thanks for the PR! I think preserveScroll
should be false
when you navigate to the next or previous page, but I agree with the filters change. I'll take a look at it soon!
It realy depends, if i have a table on the bottom of the page, then i dont want the whole page to scroll. there should be a way to configure it somehow.
Hi,
for those who waits for this merge, make your own InteractsWithQueryBuilder :
import InteractsWithQueryBuilder from '@/Components/DatatableTailwind/InteractsWithQueryBuilder';
<script>
import {InteractsWithQueryBuilder,Components} from '@protonemedia/inertiajs-tables-laravel-query-builder';
export default {
mixins: [InteractsWithQueryBuilder],
watch: {
queryBuilderData: {
deep: true,
handler() {
if (this.$inertia) {
const query = this.queryBuilderString;
this.$inertia.get(location.pathname + `?${query}`, {}, {
replace: true,
preserveState: true,
preserveScroll: true
});
}
},
},
},
};
</script>
Fixed in v2
There is no way to set the "preserveScroll" property of $inertia.get() [queryBuilderData], each time i change a filter etc, the page scrolls to the top. preserveScroll should be default behavior.
this is resolved in PR #45 in the mean time i will use my own repo. Anyway awsome package!