[ http://jira.codehaus.org/browse/DISPL-129?page=comments#action_45556 ]
Jean-Baptiste Nizet commented on DISPL-129: ------------------------------------------- Here is a real example of the use of the tag, using my patch: <display:table name="${command.displayList}" id="agent" requestURI="search.spr"> <display:setProperty name="pagination.sortdirection.param" value="direction"/> <c:url var="agentUrl" value="/agent.spr"> <c:param name="agent.id" value="${agent.id}"/> </c:url> <display:column title="Prénom" sortable="true" sortProperty="prenom"> <a href="<c:out value="${agentUrl}"/>"><c:out value="${agent.prenom}"/></a> </display:column> <display:column title="Nom" sortable="true" sortProperty="nom"> <a href="<c:out value="${agentUrl}"/>"><c:out value="${agent.nom}"/></a> </display:column> <display:column property="actif" title="Actif"/> <display:column property="telephone" title="Téléphone"/> <display:column property="fax" title="Fax"/> <display:column property="email" title="Email"/> <display:column property="ua.libelle" title="Unité d'activité" sortable="true" sortProperty="ua"/> </display:table> And here are some explanations: ${command.displayList} is an instance of the class org.displaytag.pagination.PaginatedList The <setProperty> tag is used to change the name of the sort direction parameter: "direction" is used instead of the default "dir". Three columns are sortable: "Nom", "Prénom" and "Unité d'activité". The sortProperty attribute is used to give a value to the sort parameter. If we click on the header of the column "Nom", the sort criterion will be "nom". It's up to the servlet (mapped to search.spr, the requestUri) to get the values of the request parameters "pageNumber", "sort", "direction" and, if present in the paginated list, "searchId". Using these parameters, the servlet has to get the appropriate items from the database (for example), build an instance of PaginatedList corresponding to these parameter values, and put it in the request, though that it's found by the tag under ${command.displayList}. Hope it helps. JB. > allow for partial lists where the rest remains in DB > ---------------------------------------------------- > > Key: DISPL-129 > URL: http://jira.codehaus.org/browse/DISPL-129 > Project: DisplayTag > Type: Improvement > Components: Paging/Sorting > Versions: 1.0 RC2 > Reporter: fabrizio giustina > Fix For: 1.1 > Attachments: patch.zip, patch.zip > > > ==== > imported from sf tracker > id 951204 > submitted by Ralf Hauser - ralfhauser > http://sourceforge.net/support/tracker.php?aid=951204 > ==== > displaytag is an amazing tool to spare end-users the > long download times of huge tables and make tables more > versatile. > When tables get really big, this approach still might > be problematic because the java.util.List a) take a > long time to assemble from the DB and b) may end up so > big that it will be a problem if there are multiple > parallel user sessions with huge java.util.List (or > request.setAttribute... as alternative to sessions) > Suggestion: > ========= > Allow to only provide partial lists to begin with - the > "display:table" tag as per > http://displaytag.sourceforge.net/tagreference.html#Attributes > would need the following additional attributes: > 1) list-size- default would be the size of the > java.util.List, otherwise, the programmer should > retrieve that number with SELECT COUNT(*) FROM ... > 2) call-back function name - e.g. struts action to call > with off-set parameter and rowcount if the rows to > display are not present in the partial list in the > request/session scope. On the DB-side e.g. SELECT * > FROM `TBL_MESSAGE` LIMIT 110, 145 is readily available > to do that > 3) listOffset (optional) - if java.util.List's first > entry is not what logically is considered the first element > obviously doing this is imcompatible with sort="list" > ==== > Date: 2004-09-13 17:45 > Sender: ralfhauserAccepting Donations > Logged In: YES > user_id=266141 > see a solution approach in > http://sourceforge.net/tracker/index.php?func=detail&aid=1026408& > group_id=73068&atid=536613 > Date: 2004-09-07 03:51 > Sender: ianbdev > Logged In: YES > user_id=461701 > Hello, > I posted the 872183 request. > Since then we've come up with an alternate approach. > See [ 1023387 ] Pagination - use subList instead of iterating > all records. > If this change is implemented then you can implement a List > object that overrides the subList method of the List interface. > This would allow you to limit database/datasource accesses > to obtain just the few page records required for the page > being displayed. > No other changes to display tag are required. > Date: 2004-05-27 15:12 > Sender: carlossg > Logged In: YES > user_id=792979 > This has been already pointed out in RFE 872183 > Date: 2004-05-10 21:13 > Sender: smccrory > Logged In: YES > user_id=20779 > Also see https://sourceforge.net/tracker/index.php? > func=detail&aid=950819&group_id=73068&atid=536613 -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf _______________________________________________ displaytag-devel mailing list displaytag-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/displaytag-devel