close #1003 Fixed: Pagination limit change feature not working
This commit is contained in:
parent
d2b78e27c7
commit
c33a72d92b
39
resources/assets/js/mixins/global.js
vendored
39
resources/assets/js/mixins/global.js
vendored
@ -235,6 +235,45 @@ export default {
|
||||
})
|
||||
.catch(error => {
|
||||
});
|
||||
},
|
||||
|
||||
onChangePaginationLimit(event) {
|
||||
let path = '';
|
||||
|
||||
if (window.location.search.length) {
|
||||
if (window.location.search.includes('limit')) {
|
||||
let queries = [];
|
||||
let query = window.location.search;
|
||||
|
||||
query = query.replace('?', '');
|
||||
queries = query.split('&');
|
||||
|
||||
path = window.location.origin + window.location.pathname;
|
||||
|
||||
queries.forEach(function (_query, index) {
|
||||
let query_partials = _query.split('=');
|
||||
|
||||
if (index == 0) {
|
||||
path += '?'
|
||||
} else {
|
||||
path += '&';
|
||||
}
|
||||
|
||||
if (query_partials[0] == 'limit') {
|
||||
path += 'limit=' + event.target.value;
|
||||
} else {
|
||||
path += query_partials[0] + '=' + query_partials[1];
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
path = window.location.href + '&limit=' + event.target.value;
|
||||
}
|
||||
} else {
|
||||
path = window.location.href + '?limit=' + event.target.value;
|
||||
}
|
||||
|
||||
window.location.href = path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
<span class="table-text hidden-lg">
|
||||
{{ trans('general.show') }}
|
||||
</span>
|
||||
{!! Form::select('limit', $limits, request('limit', setting('default.list_limit', '25')), ['class' => 'form-control form-control-sm table-header-search hidden-md', 'onchange' => 'this.form.submit()']) !!}
|
||||
{!! Form::select('limit', $limits, request('limit', setting('default.list_limit', '25')), ['class' => 'form-control form-control-sm table-header-search hidden-md', '@change' => 'onChangePaginationLimit($event)']) !!}
|
||||
<span class="table-text hidden-lg">
|
||||
{{ trans('pagination.page') }}
|
||||
{{ trans('pagination.showing', ['first' => $items->firstItem(), 'last' => $items->lastItem(), 'total' => $items->total(), 'type' => strtolower((isset($title)) ? $title : trans_choice('general.' . $type, 2))]) }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user