Include the query part of the request, when generating the url for the datatables via a custom twig function.

This fixes issue #735, as without this the query gets not passed to the datatable
This commit is contained in:
Jan Böhmer 2024-10-16 23:57:02 +02:00
parent 15ad0ec9c0
commit 7d834ac8d7
11 changed files with 29 additions and 12 deletions

View file

@ -1,5 +1,5 @@
{% macro datatable(datatable, controller = 'elements/datatables/datatables', state_save_tag = null) %}
<div {{ stimulus_controller(controller, {"stateSaveTag": state_save_tag}) }} data-dt-settings='{{ datatable_settings(datatable)|escape('html_attr') }}' data-dt-url="{{ app.request.baseUrl ~ app.request.pathInfo }}">
<div {{ stimulus_controller(controller, {"stateSaveTag": state_save_tag}) }} data-dt-settings='{{ datatable_settings(datatable)|escape('html_attr') }}' data-dt-url="{{ uri_without_host(app.request) }}">
<div {{ stimulus_target(controller, 'dt') }}>
<div class="card-body">
<div class="card">
@ -20,12 +20,12 @@
{% macro partsDatatableWithForm(datatable, state_save_tag = 'parts') %}
<form method="post" action="{{ path("table_action") }}"
{# The app.request.baseUrl here is important or it wont work behind a reverse proxy with subfolder #}
{{ stimulus_controller('elements/datatables/parts', {"stateSaveTag": state_save_tag}) }} data-dt-settings='{{ datatable_settings(datatable)|escape('html_attr') }}' data-dt-url="{{ app.request.baseUrl ~ app.request.pathInfo }}"
{{ stimulus_controller('elements/datatables/parts', {"stateSaveTag": state_save_tag}) }} data-dt-settings='{{ datatable_settings(datatable)|escape('html_attr') }}' data-dt-url="{{ uri_without_host(app.request) }}"
{{ stimulus_action('elements/datatables/parts', 'confirmDeletionAtSubmit') }} data-delete-title="{% trans %}part_list.action.delete-title{% endtrans %}"
data-delete-message="{% trans %}part_list.action.delete-message{% endtrans %}">
<input type="hidden" name="_token" value="{{ csrf_token('table_action') }}">
<input type="hidden" name="redirect_back" value="{{ app.request.baseUrl ~ app.request.pathInfo }}">
<input type="hidden" name="redirect_back" value="{{ uri_without_host(app.request) }}">
<input type="hidden" name="ids" {{ stimulus_target('elements/datatables/parts', 'selectIDs') }} value="">