Skip to content

Commit

Permalink
improve display of total count and total pages
Browse files Browse the repository at this point in the history
Issue #613
  • Loading branch information
rsoika committed Nov 8, 2024
1 parent e512fdc commit c3e352d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,22 @@
src="#{facesContext.externalContext.requestContextPath}/js/imixs-office.worklist.custom.js?build=#{app.application_build_timestamp}"></script>
</ui:define>



<ui:define name="content">
<f:view>
<h:form>
<ui:param name="searchresult" value="#{viewHandler.getData(searchController)}"></ui:param>
<ui:param name="searchresultCount" value="#{searchController.getCount()}"></ui:param>


<h:panelGroup styleClass="imixs-view imixs-search" layout="block" id="serach_view">
<h:panelGroup styleClass="imixs-view imixs-search" layout="block" id="search_view">
<ui:param name="searchresult" value="#{viewHandler.getData(searchController)}"></ui:param>
<ui:param name="noresult"
value="#{(empty searchresult) and (empty searchController.searchFilter.item['phrase'])}">
</ui:param>
<ui:param name="searchresultCount" value="#{searchController.getTotalCount()}"></ui:param>
<ui:param name="searchPage"
value="#{(searchController.getPageIndex()+1)}/#{(searchController.getTotalPages()+1)}">
</ui:param>
<h:panelGroup rendered="#{(!empty searchresult) }">
<!-- placeholder to ensure data is loaded immediately - do not remove -->
</h:panelGroup>


<div class="imixs-header">
Expand All @@ -48,8 +54,6 @@
</h1>
</div>



<div class="imixs-body">
<!-- *** Header **** -->
<ui:fragment rendered="#{empty searchController.defaultQuery}">
Expand Down Expand Up @@ -83,25 +87,32 @@
itemLabel="#{message['worklist.sortorder_relevance']}" />
<f:selectItem itemValue="3"
itemLabel="#{message['worklist.sortorder_lastupdate']}" />

<f:selectItem itemValue="1"
itemLabel="#{message['worklist.sortorder_newest']}" />
<f:selectItem itemValue="2"
itemLabel="#{message['worklist.sortorder_oldest']}" />


<f:ajax event="change" render="@form"
listener="#{searchController.refreshSearch}"
onevent="imixsOfficeMain.layoutAjaxEvent" />
</h:selectOneMenu>
<span>
<h:outputText style="margin-left:7px;" value="#{searchPage}" />
</span>
</div>

<h:commandButton actionListener="#{viewHandler.back(searchController)}"
style="height: 31px;" disabled="#{searchController.pageIndex==0}"
value="◀◀ #{message.prev}">
<f:ajax render="serach_view"
<f:ajax render="search_view"
onevent="function(data) { imixsOfficeMain.layoutAjaxEvent(data, '#{component.parent.parent.clientId}') }" />
</h:commandButton>
<h:commandButton actionListener="#{viewHandler.forward(searchController)}"
style="height: 31px;" disabled="#{searchController.endOfList}"
value="#{message.next} ▶▶">
<f:ajax render="serach_view"
<f:ajax render="search_view"
onevent="function(data) { imixsOfficeMain.layoutAjaxEvent(data, '#{component.parent.parent.clientId}') }" />
</h:commandButton>

Expand All @@ -111,9 +122,7 @@
</div>


<ui:param name="noresult"
value="#{(empty searchresult) and (empty searchController.searchFilter.item['phrase'])}">
</ui:param>


<ui:fragment rendered="#{!noresult}">
<h:panelGroup layout="block" id="worklist-body">
Expand Down Expand Up @@ -157,12 +166,12 @@
<div class="pull-right ">
<h:commandButton actionListener="#{viewHandler.back(searchController)}"
disabled="#{searchController.pageIndex==0}" value="◀◀ #{message.prev}">
<f:ajax render="serach_view"
<f:ajax render="search_view"
onevent="function(data) { imixsOfficeMain.layoutAjaxEvent(data, '#{component.parent.parent.clientId}') }" />
</h:commandButton>
<h:commandButton actionListener="#{viewHandler.forward(searchController)}"
disabled="#{searchController.endOfList}" value="#{message.next} ▶▶">
<f:ajax render="serach_view"
<f:ajax render="search_view"
onevent="function(data) { imixsOfficeMain.layoutAjaxEvent(data, '#{component.parent.parent.clientId}') }" />
</h:commandButton>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import org.imixs.workflow.engine.index.SchemaService;
import org.imixs.workflow.exceptions.InvalidAccessException;
import org.imixs.workflow.exceptions.ModelException;
import org.imixs.workflow.exceptions.QueryException;
import org.imixs.workflow.faces.data.ViewController;
import org.imixs.workflow.faces.util.LoginController;
import org.imixs.workflow.office.config.SetupController;
Expand Down Expand Up @@ -590,13 +589,4 @@ public String getQuery() {
return query;
}

public long getCount() {
long result = 0;
try {
result = documentService.count(getQuery());
} catch (QueryException e) {
e.printStackTrace();
}
return result;
}
}

0 comments on commit c3e352d

Please sign in to comment.