N°1386 - Advanced Search: Navigation in list - Browse this list - back from run_query

This commit is contained in:
acognet
2023-05-25 16:07:15 +02:00
parent 9ebcbf2459
commit b852e72088
15 changed files with 132 additions and 44 deletions

View File

@@ -0,0 +1,7 @@
{# @copyright Copyright (C) 2010-2023 Combodo SARL #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
$("form[id^='basket']").each(function () {
$(this).append($('<input/>')
.attr({'type': 'hidden', 'name': 'back_posted_fields', 'value': '{{ oUIBlock.GetPostedFieldsForBackUrl()|raw }}'})
);
});

View File

@@ -7,12 +7,3 @@ oSelectedItems{{ oUIBlock.GetOption('sListId')|sanitize(constant('utils::ENUM_SA
var bSelectAllowed{{ oUIBlock.GetId()|sanitize(constant('utils::ENUM_SANITIZATION_FILTER_VARIABLE_NAME')) }} = false;
$('body').append($('<form/>')
.attr({'method': 'post', 'id': 'basket{{ oUIBlock.GetId() }}'})
.append($('<input/>')
.attr({'type': 'hidden', 'name': 'filter', 'value': "{{ oUIBlock.GetFilter()|raw }}"})
)
.append($('<input/>')
.attr({'type': 'hidden', 'name': 'back_url', 'value': window.location.href})
)
);

View File

@@ -462,6 +462,16 @@ if ($('#datatable_dlg_{{ oUIBlock.GetId() }}').hasClass('itop-datatable'))
}
$('#datatable_dlg_{{ oUIBlock.GetId() }}').DataTableSettings(aOptions{{ sListIDForVarSuffix }});
$('body').append($('<form/>')
.attr({'method': 'post', 'id': 'basket{{ oUIBlock.GetId() }}'})
.append($('<input/>')
.attr({'type': 'hidden', 'name': 'filter', 'value': "{{ oUIBlock.GetFilter()|raw }}"})
)
.append($('<input/>')
.attr({'type': 'hidden', 'name': 'back_url', 'value': window.location.href})
)
);
if (window.ResizeObserver)
{
let oTable{{ sListIDForVarSuffix }}ResizeTimeout = null;
@@ -476,4 +486,4 @@ if (window.ResizeObserver)
{% if oUIBlock.HasRowActions() %}
{% include 'base/components/datatable/row-actions/handler.js.twig' %}
{% endif %}
{% endif %}

View File

@@ -1,26 +1,27 @@
{# @copyright Copyright (C) 2010-2021 Combodo SARL #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
<div id="{{ oUIBlock.GetId() }}"
class="{{ oUIBlock.GetBlocksInheritanceCSSClassesAsString() }} {{ oUIBlock.GetAdditionalCSSClassesAsString() }} {{ oUIBlock.GetCSSColorClass() }} {% if oUIBlock.IsHidden() %}ibo-is-hidden{% endif %} ibo-is-opened" data-role="ibo-navigation">
{% block iboNavigation %}
<form id="ibo-form-navigation" class="ibo-navigation-form" method="post">
<input type="hidden" name="list_navigation" value="{{ oUIBlock.GetList() }}"/>
<input type="hidden" name="filter" value="{{ oUIBlock.GetFilter() }}"/>
<input type="hidden" name="back_url" value="{{ oUIBlock.GetBackUrl()|raw }}"/>
<div class="ibo-form-navigation--nav fas fa-angle-up" id="{{ oUIBlock.GetId() }}-back"></div>
{% if oUIBlock.HasPrec() %}
<div class="ibo-form-navigation--nav fas fa-angle-double-left" id="{{ oUIBlock.GetId() }}-first"></div>
<div class="ibo-form-navigation--nav fas fa-angle-left" id="{{ oUIBlock.GetId() }}-prev"></div>
{% else %}
&#160;&#160;&#160;
{% endif %}
<div class="ibo-form-navigation--total">{{ oUIBlock.GetIdx() }} / {{ oUIBlock.GetCount() }}</div>
{% if oUIBlock.HasNext() %}
<div class="ibo-form-navigation--nav fas fa-angle-right" id="{{ oUIBlock.GetId() }}-next"></div>
<div class="ibo-form-navigation--nav fas fa-angle-double-right" id="{{ oUIBlock.GetId() }}-last"></div>
{% else %}
&#160;&#160;&#160;
{% endif %}
</form>
{% endblock %}
<div id='{{ oUIBlock.GetId() }}'
class='{{ oUIBlock.GetBlocksInheritanceCSSClassesAsString() }} {{ oUIBlock.GetAdditionalCSSClassesAsString() }} {{ oUIBlock.GetCSSColorClass() }} {% if oUIBlock.IsHidden() %}ibo-is-hidden{% endif %} ibo-is-opened' data-role='ibo-navigation'>
{% block iboNavigation %}
<form id='ibo-form-navigation' class='ibo-navigation-form' method='post'>
<input type='hidden' name='list_navigation' value='{{ oUIBlock.GetList() }}'/>
<input type='hidden' name='filter' value='{{ oUIBlock.GetFilter() }}'/>
<input type='hidden' name='back_posted_fields' value='{{ oUIBlock.GetPostedFields()|raw }}'/>
<input type='hidden' name='back_url' value='{{ oUIBlock.GetBackUrl()|raw }}'/>
<div class='ibo-form-navigation--nav fas fa-angle-up' id='{{ oUIBlock.GetId() }}-back'></div>
{% if oUIBlock.HasPrec() %}
<div class='ibo-form-navigation--nav fas fa-angle-double-left' id='{{ oUIBlock.GetId() }}-first'></div>
<div class='ibo-form-navigation--nav fas fa-angle-left' id='{{ oUIBlock.GetId() }}-prev'></div>
{% else %}
&#160;&#160;&#160;
{% endif %}
<div class='ibo-form-navigation--total'>{{ oUIBlock.GetIdx() }} / {{ oUIBlock.GetCount() }}</div>
{% if oUIBlock.HasNext() %}
<div class='ibo-form-navigation--nav fas fa-angle-right' id='{{ oUIBlock.GetId() }}-next'></div>
<div class='ibo-form-navigation--nav fas fa-angle-double-right' id='{{ oUIBlock.GetId() }}-last'></div>
{% else %}
&#160;&#160;&#160;
{% endif %}
</form>
{% endblock %}
</div>

View File

@@ -2,7 +2,13 @@
{# @license http://opensource.org/licenses/AGPL-3.0 #}
$('#{{ oUIBlock.GetId() }}-back').on('click', function () {
window.location = '{{ oUIBlock.GetBackUrl()|raw }}';
$('#ibo-form-navigation').attr('action', ' {{ oUIBlock.GetBackUrl() | raw }} ');
JSON.parse('{{ oUIBlock.GetPostedFields() | raw }}', (key, value) => {
$('#ibo-form-navigation').append($('<input/>').attr({'type': 'hidden', 'name': key, 'value': value}));
});
$('#ibo-form-navigation').submit();
});
$('#{{ oUIBlock.GetId() }}-first').on('click', function () {