Добрый день!
Есть следующий вопрос: есть браузер экрана, в котором применяется пагинация. Данные разбиты на 2 страницы: на первой странице 10 элементов и 2 элемента на второй странице.
Это первая страница:
Вторая страница
В фильтре я вбиваю название, которое лежит на первой странице:
По нажатию кнопки фильтрации, получаю 0 отфильтрованных элементов
Нужно перейти на 1-ю страницу и там список будет отфильтрован:
Не уверен, может это и корректное поведение, но как пользователю, мне не совсем очевидно, что нужно еще и бегать по страницам, чтобы найти отфильтрованные мной данные. Это сейчас в примере всего 2 страницы, а если страниц 1000 штук, я нахожусь на 1000-й странице, а отфильтрованный мною элемент лежит на 1-й странице. Получается не очень удобно. Можно как-то поправить данное поведение?
Добрый день!
Скажите, пожалуйста, какая версия Jmix используется?
Добрый день!
Версия 2.1.2
Не удается воспроизвести ошибку. Пробовал устанавливать лимиты на отображение количества элементов на странице через jmix.ui.default-page-size и через параметры simplePagination. Далее переходил на вторую страницу и в фильтре указывал значение с первой страницы. Фильтр отрабатывал корректно и отображал первую страницу с элементом.
Данная проблема возникает только на одном экране или на всех?
Попробуйте проверить работу стандартного фильтра на списке пользователей.
@s.markevich у меня используется кастомный фильтр, вот пример дескриптора экрана. Компоненты фильтра в теге details
находятся:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<view xmlns="http://jmix.io/schema/flowui/view"
xmlns:c="http://jmix.io/schema/flowui/jpql-condition"
title="msg://agentListView.title"
focusComponent="agentsDataGrid">
<data readOnly="true">
<collection id="agentsDc"
class="ru.ctsg.damdbf.manager.core.entity.Agent">
<fetchPlan extends="_base"/>
<loader id="agentsDl">
<query>
<![CDATA[select e from Agent e]]>
</query>
</loader>
</collection>
</data>
<facets>
<dataLoadCoordinator auto="true"/>
<urlQueryParameters>
<pagination component="pagination" maxResultsParam="10"/>
</urlQueryParameters>
<settings id="settingsFacet"/>
</facets>
<actions>
<action id="selectAction" type="lookup_select"/>
<action id="discardAction" type="lookup_discard"/>
</actions>
<layout>
<details id="details" summaryText="msg://ru.ctsg.damdbf.manager.view.agent/filter" opened="true">
<formLayout id="form">
<responsiveSteps>
<responsiveStep minWidth="0em" columns="3"/>
</responsiveSteps>
<multiSelectComboBox id="filterNameComboBox" property="name"
label="msg://ru.ctsg.damdbf.manager.view.agent/nameFilter"
width="15em" classNames="filterBox">
<itemsQuery escapeValueForLike="true"
searchStringFormat="(?i)%${inputString}%">
<query>
<![CDATA[select distinct e.name from Agent e where e.name
like :searchString escape '\' order by e.name asc]]>
</query>
</itemsQuery>
</multiSelectComboBox>
<multiSelectComboBox id="filterStatusComboBox"
itemsEnum="ru.ctsg.damdbf.manager.core.enums.AgentStatus"
label="msg://ru.ctsg.damdbf.manager.view.agent/statusFilter" width="15em"
classNames="filterBox"/>
<multiSelectComboBox id="filterHostComboBox" property="host"
label="msg://ru.ctsg.damdbf.manager.view.agent/hostFilter" width="15em"
classNames="filterBox">
<itemsQuery escapeValueForLike="true"
searchStringFormat="(?i)%${inputString}%">
<query>
<![CDATA[select e.host from Agent e where e.host
like :searchString escape '\' order by e.host asc]]>
</query>
</itemsQuery>
</multiSelectComboBox>
<dateTimePicker id="filterLastStartDateFromDateTimePicker" property="lastStartDate"
label="msg://ru.ctsg.damdbf.manager.view.agent/lastStartDateFrom"
width="15em" classNames="filterBox"/>
<dateTimePicker id="filterLastStartDateToDateTimePicker" property="lastStartDate"
label="msg://ru.ctsg.damdbf.manager.view.agent/lastStartDateTo"
width="15em" classNames="filterBox"/>
<dateTimePicker id="filterTransitionDateFromDateTimePicker" property="transitionDate"
label="msg://ru.ctsg.damdbf.manager.view.agent/transitionDateFrom" width="15em"
classNames="filterBox"/>
<dateTimePicker id="filterTransitionDateToDateTimePicker" property="transitionDate"
label="msg://ru.ctsg.damdbf.manager.view.agent/transitionDateTo" width="15em"
classNames="filterBox"/>
<hbox classNames="hboxFilterButton" colspan="3">
<button id="refreshFilterBtn" action="agentsDataGrid.refresh" classNames="refreshFilterBtn"/>
<button id="clearFilterBtn" action="agentsDataGrid.clear" classNames="clearFilterBtn"/>
</hbox>
</formLayout>
</details>
<hbox id="buttonsPanel" classNames="buttons-panel">
<button id="startAgentBtn" action="agentsDataGrid.startAgent" classNames="vaadin-startAgentBtn, vaadin-startAgentBtn[disabled]"/>
<button id="stopAgentBtn" action="agentsDataGrid.stopAgent" classNames="vaadin-stopAgentBtn, vaadin-stopAgentBtn[disabled]" />
<button id="removeBtn" action="agentsDataGrid.remove" classNames="vaadin-removeBtn, vaadin-removeBtn[disabled]"/>
</hbox>
<dataGrid id="agentsDataGrid"
width="100%"
minHeight="20em"
dataContainer="agentsDc"
columnReorderingAllowed="true"
selectionMode="MULTI">
<actions>
<action id="remove" type="list_remove"/>
<action id="refresh" type="list_refresh" text="msg://ru.ctsg.damdbf.manager.ui.action/Search"
icon="SEARCH"/>
<action id="edit" type="list_edit">
<properties>
<property name="openMode" value="DIALOG"/>
</properties>
</action>
<action id="startAgent" type="list_itemTracking"
text="msg://ru.ctsg.damdbf.manager.ui.action/StartAgentAction" icon="PLAY"/>
<action id="stopAgent" type="list_itemTracking"
text="msg://ru.ctsg.damdbf.manager.ui.action/StopAgentAction" icon="STOP"/>
<action id="clear" text="msg://ru.ctsg.damdbf.manager.ui.action/Clear" icon="MINUS_CIRCLE_O"/>
</actions>
<columns resizable="true">
<column property="name" autoWidth="true"/>
<column property="host" autoWidth="true"/>
<column property="status" autoWidth="true"/>
<column property="transitionDate" autoWidth="true"/>
<column property="lastStartDate" autoWidth="true"/>
<column property="description" autoWidth="true" editable="true"/>
</columns>
</dataGrid>
<hbox alignSelf="CENTER">
<simplePagination id="pagination" dataLoader="agentsDl" itemsPerPageVisible="true"
itemsPerPageItems="10, 20, 50, 100" itemsPerPageDefaultValue="10" alignSelf="CENTER"/>
</hbox>
<hbox id="lookupActions" visible="false">
<button id="selectBtn" action="selectAction"/>
<button id="discardBtn" action="discardAction"/>
</hbox>
</layout>
</view>
Вероятно из-за этого где-то возникает проблема. Потому что если используется genericFilter
то да, такой проблемы не возникает. Нужна ли еще какая-то дополнительная информация для поиска проблемы?
@s.markevich решился вопрос: перед фильтрацией данных устанавливаю значение 0
для страницы
@Subscribe("agentsDataGrid.refresh")
public void onAgentsDataGridRefresh(final ActionPerformedEvent event) {
reload();
}
private void reload() {
agentsDl.setFirstResult(0);
String query = "select e from Agent e";
}
Отлично.
Благодарим за обращение.
Хорошего дня!