Develop > Presentation layer > Customize IBM Sales Center > Customizing Sales Center support for large shopping carts
Add pagination to editor pages
The following high level steps were used to add pagination to the comments page of the Order editor.
Procedure
- Extend the pagination manager composite, and provide concrete definition for controls. The following definition should be part of the Order fragment, which is located in "com.ibm.commerce.telesales.ui.impl.order/fragment.xml".
<managedComposite id="orderCommentsPaginationBarManagedComposite" referenceId="paginationBarManagedComposite"> <widgetManager id="orderCommentsWidgetManager" /> <dynamicIdBinding dynamicId="com.ibm.commerce.telesales.ui.impl.paginationBarRecordsListLabel" concreteId="com.ibm.commerce.telesales.ui.impl.commentsPaginationBarRecordsListLabel" /> <dynamicIdBinding dynamicId="com.ibm.commerce.telesales.ui.impl.paginationBarPageListLabel" concreteId="com.ibm.commerce.telesales.ui.impl.commentsPaginationBarPageListLabel" /> <dynamicIdBinding dynamicId="com.ibm.commerce.telesales.ui.impl.paginationBarPageFirstButton" concreteId="com.ibm.commerce.telesales.ui.impl.commentsPaginationBarPageFirstButton" /> <dynamicIdBinding dynamicId="com.ibm.commerce.telesales.ui.impl.paginationBarPagePreviousButton" concreteId="com.ibm.commerce.telesales.ui.impl.commentsPaginationBarPagePreviousButton" /> <dynamicIdBinding dynamicId="com.ibm.commerce.telesales.ui.impl.paginationBarPageNextButton" concreteId="com.ibm.commerce.telesales.ui.impl.commentsPaginationBarPageNextButton" /> <dynamicIdBinding dynamicId="com.ibm.commerce.telesales.ui.impl.paginationBarPageLastButton" concreteId="com.ibm.commerce.telesales.ui.impl.commentsPaginationBarPageLastButton" /> <dynamicIdBinding dynamicId="com.ibm.commerce.telesales.ui.impl.paginationBarJumpToPageTextField" concreteId="com.ibm.commerce.telesales.ui.impl.commentsPaginationBarJumpToPageTextField" /> <dynamicIdBinding dynamicId="com.ibm.commerce.telesales.ui.impl.paginationBarJumpToPageButton" concreteId="com.ibm.commerce.telesales.ui.impl.commentsPaginationBarJumpToPageButton" /> <property name="triggerFindOnFirstActivate" value="true" /> </managedComposite> <extension point="com.ibm.commerce.telesales.widgets.controls"> <control id="commentsPaginationBarPageFirstButton" referenceId="paginationBarPageFirstButton" managerType="orderCommentsManagerType" /> <control id="commentsPaginationBarPagePreviousButton" referenceId="paginationBarPagePreviousButton" managerType="orderCommentsManagerType" /> <control id="commentsPaginationBarPageNextButton" referenceId="paginationBarPageNextButton" managerType="orderCommentsManagerType" /> <control id="commentsPaginationBarPageLastButton" referenceId="paginationBarPageLastButton" managerType="orderCommentsManagerType" /> <control id="commentsPaginationBarJumpToPageTextField" referenceId="paginationBarJumpToPageTextField" managerType="orderCommentsManagerType" /> <control id="commentsPaginationBarJumpToPageButton" referenceId="paginationBarJumpToPageButton" managerType="orderCommentsManagerType" /> <control id="commentsPaginationBarRecordsListLabel" referenceId="paginationBarRecordsListLabel" managerType="orderCommentsManagerType" /> <control id="commentsPaginationBarPageListLabel" referenceId="paginationBarPageListLabel" managerType="orderCommentsManagerType" /> <control id="itemsPaginationBarPagePreviousButton" referenceId="paginationBarPagePreviousButton" managerType="salesContainerItemPageManager" /> <control id="itemsPaginationBarPageNextButton" referenceId="paginationBarPageNextButton" managerType="salesContainerItemPageManager" /> </extension>
- Override the following method in the page for which to include pagination. And return the managed composite. This is in the "OrderCommentsConfigurablePage.java" page class.
/** * This method returns the top button bar managed composite ID. Subclasses must * implement this method to provide a top button bar. This implementation returns * <code>null</code>. * @return the top button bar managed composite ID */ protected String getTopButtonBarManagedCompositeId() { return PAGINATION_BAR_COMPOSITE_ID; } */ public static final String ORDER_COMMENTS_MANAGED_COMPOSITE_ID = "com.ibm.commerce.telesales.ui.impl.orderCommentsManagedComposite";
- Now the Comments tab of the order editor contains the pagination tools.
- Override the following methods in the widget manager to populate the data. This is located in the OrderEditorCommentsPageWidgetManager.java.
/** * Constructs the parameters for the com.ibm.commerce.telesales.findOrderComments * service request. * * @param order The order associated with the comment. * @return parameters for the find order comment action * @see Order */ protected TelesalesProperties getFindParameters() { // construct parameters to make server call. } /** * This method returns the string ID of the ServiceRequest that knows how to request * the data that needs to be found. * Subclasses must implement. * @see com.ibm.commerce.telesales.core.TelesalesServiceRequest * @return serviceRequestId string */ protected String getFindServiceRequestID() { return "com.ibm.commerce.telesales.findOrderComments"; } /** * Override this method to have data from server for current page. Set data to model * or to control to display the data. */ protected void setSearchResult(Object commentobjects[]) { ((Order)getSalesContainer()).clearComments(); if (commentobjects != null && commentobjects.length > 0) { for (int i = 0; i < commentobjects.length; i++) { SalesContainerComment entry = (SalesContainerComment) commentobjects[i]; ((Order)getSalesContainer()).addComment(entry); } } } /** * Return the unique pagination identifier for this page. This will be used by * pagination manager to maintain properties of pagination for specific page. */ public String getUniqueIdentifier() { return OrderCommentsConfigurablePage.EDITOR_PAGE_ID; }
- Call refreshCurrentPage from the manager whenever to refresh the current page content with most recent data from the server.
Related concepts