fix: Paging buttons not working on item group portal page

This commit is contained in:
marination 2021-07-14 20:01:36 +05:30
parent 727e5d16bc
commit 4c6e952902

View File

@ -127,15 +127,36 @@
</script>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="row mt-6">
<div class="col-3">
</div>
<div class="col-9">
{% if frappe.form_dict.start|int > 0 %}
<button class="btn btn-outline-secondary btn-prev" data-start="{{ frappe.form_dict.start|int - page_length }}">{{ _("Prev") }}</button>
<button class="btn btn-outline-secondary btn-prev" data-start="{{ frappe.form_dict.start|int - page_length }}">
{{ _("Prev") }}
</button>
{% endif %}
{% if items|length >= page_length %}
<button class="btn btn-outline-secondary btn-next" data-start="{{ frappe.form_dict.start|int + page_length }}">{{ _("Next") }}</button>
<button class="btn btn-outline-secondary btn-next" data-start="{{ frappe.form_dict.start|int + page_length }}"
style="float: right;">
{{ _("Next") }}
</button>
{% endif %}
</div>
</div>
</div>
<script>
frappe.ready(() => {
$('.btn-prev, .btn-next').click((e) => {
const $btn = $(e.target);
$btn.prop('disabled', true);
const start = $btn.data('start');
let query_params = frappe.utils.get_query_params();
query_params.start = start;
let path = window.location.pathname + '?' + frappe.utils.get_url_from_dict(query_params);
window.location.href = path;
});
});
</script>
{% endblock %}