I'm trying to modify our "Items per page" setting, but can't find it anywhere :(
We are using 4.1.2
You need to be logged in to post messages
By Nick Harris
I'm trying to modify our "Items per page" setting, but can't find it anywhere :(
We are using 4.1.2
Do you mean the default number of records that are displayed in a paged table? Are you trying to set it globally or per paged table?
I don't see any itemsPerPage parameter in the tag descriptor for <dhv:pagedListStatus/>, but there may be an option to set it globally I'll have to check back with you.
I didn't see any support for a global parameter either. If you were only doing this for one jsp you could put in a scriplet to replace the default of 10 with your own. Like the following example where the default (10) is replaced with 50:
<%
PagedListInfo pagedListInfo =
(PagedListInfo) pageContext.getSession().getAttribute("SalesDashboardListInfo");
if(pagedListInfo != null && pagedListInfo.getItemsPerPage() == PagedListInfo.DEFAULT_ITEMS_PER_PAGE)
pagedListInfo.setItemsPerPage(50);
pageContext.getSession().removeAttribute("SalesDashboardListInfo");
pageContext.getSession().setAttribute("SalesDashboardListInfo", pagedListInfo);
}
%>
<dhv:pagedListStatus title='<%= showError(request, "actionError") %>' object="SalesDashboardListInfo"/>
The user can still override with their own selection from the dropdown since that gets checked inside the <dhv:pagedListStatus /> taglib
Try DEFAULT_ITEMS_PER_PAGE in the PagedListInfo class... I didn't check it!
By Nick Harris
Ok, I've set this up to show all (-1) but it only actually shows all when the page is reloaded, not on the initial load.
By dumping out some info, I can see that the first load is still the default 10.
Here is the code I'm using:
<%
PagedListInfo pagedListInfo = (PagedListInfo) request.getSession().getAttribute("productCatalogListInfo");
if (pagedListInfo != null)
pagedListInfo.setItemsPerPage(-1);
pageContext.getSession().removeAttribute("productCatalogListInfo");
pageContext.getSession().setAttribute("productCatalogListInfo", pagedListInfo);
}
%>
I've tried different ways of getting the session, and they all act the same.
Any help would be most appreciated!
Couple of thoughts:
1) The server action initially controls the pagedListInfo and performs the query -- before the JSP code renders it... so, the best would be to update the server action and change the parameters of the pagedListInfo there
2) If updating the .java file isn't what you want to do, then you could put the JSP code in another file that loads before the page in question is rendered. That might work.