Skip to content

Commit

Permalink
Update scripts.blade.php
Browse files Browse the repository at this point in the history
  • Loading branch information
wimurk authored Feb 13, 2020
1 parent 044ef93 commit 0bd01b3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/resources/views/scripts.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,14 @@ function initDatatable{{ $view->tableId }}()
table{{ $view->tableId }} = $('#{{ $view->tableId }}').DataTable(Json{{ $view->tableId }});
@if($view->rememberPage)
$(document).on('click', '#{{ $view->tableId }}_wrapper .paginate_button', () => {
window.history.pushState('laravel-datatable', 'pagination', `${location.origin}${location.pathname}?datatables-page=${table{{ $view->tableId }}.page.info().page + 1}`);
let url = location.href.split(`datatables-page=`)[0];
if(url.slice(-1) === '?' || url.slice(-1) === '&'){
url = url.slice(0, -1);
}
let mark = url.includes('?') ? "&" : "?";
window.history.pushState('laravel-datatable', 'pagination', `${url}${mark}datatables-page=${table{{ $view->tableId }}.page.info().page + 1}`);
});
@endif
}
Expand Down

0 comments on commit 0bd01b3

Please sign in to comment.