Skip to content

Commit a8d3c39

Browse files
authored
fix issue where the page number is not updated in URL params (#703)
* fix issue where the page number is not updated in URL params * fix issue where the page number is not updated in URL params
1 parent 776e4e3 commit a8d3c39

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

starlette_admin/statics/js/list.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,12 @@ $(function () {
415415
},
416416

417417
stateSaveCallback: function (settings, data) {
418+
let page = 0;
419+
try {
420+
page = (data?.page ?? data?.start / data?.length ?? 0) + 1;
421+
} catch (e) {}
418422
const params = {
419-
page: (data?.page ?? 0) + 1,
423+
page: page,
420424
page_size: data?.length,
421425
search: data?.search?.search,
422426
order: data?.order

starlette_admin/templates/list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,5 +158,5 @@ <h1>{{ model.label }}</h1>
158158
<script type="text/javascript"
159159
src="{{ url_for(__name__ ~ ':statics', path='js/actions.js').include_query_params(v=1) }}"></script>
160160
<script type="text/javascript"
161-
src="{{ url_for(__name__ ~ ':statics', path='js/list.js').include_query_params(v=1) }}"></script>
161+
src="{{ url_for(__name__ ~ ':statics', path='js/list.js').include_query_params(v=2) }}"></script>
162162
{% endblock %}

0 commit comments

Comments
 (0)