(1) Load a disconnected record set (store in your session), determine your page size, and then just create a loop within a velocity macro that starts at a pre-determined index, and loop a pre-determined number of times (dependant upon the page size). This is fine and very fast as long as you are not caching hundreds of records. In that case it may use up more memory than you might wish. The trick here is that the starting index is determined from the page number.
(2) Use some kind of persistant storage (a DBMS for example). Initially query the set of data and store it within the DBMS with some kind of index. Again you simply loop through the records with the Velocity macro to display the page (by looping from a starting to an ending index)
I found this to be a type of problem that was more dependant upon correctly handling sets of data within some Java data structures or the DBMS rather than strictly a Velocity/Turbine problem.
Once you have this working with Velocity in some fashion, it should not be a problem to refine it tocreate a Velocity macro and some supporting classes to create canned functionality.
If you are interested I can supply you with some very easy to use classes to support the type of functionality described in (1). It is a disconnected serializeable record set, with column sorting/filtering, easy loading (from a query, a result set, manually, etc), change tracking for easy updates, updateable bound field and table controls for Swing (oops cross posting here), fully java doc'd, etc. I wrote these about four years ago and they are very stable (and probably the cleanest thing that I have written). Frankly I was never sure how to go about publishing them, or if anyone would be interested.
As an aside (again sorry for the cross post), if anyone has a suggestion on how to contribute something such as this for public use (or damnation) it would be appreciated.
Hope this helps.
----- Original Message ----- From: "Rudi Vaum" <[EMAIL PROTECTED]>
To: "Turbine Users List" <[email protected]>
Sent: Tuesday, May 17, 2005 2:34 AM
Subject: AW: Reusable html table with column sorting and page-at-a-time scrolling
yes but this is a jsp taglib. I'd like to use Turbine with Velocity.
Thanks Rudi
-----Ursprungliche Nachricht----- Von: Louis Moore [mailto:[EMAIL PROTECTED] Gesendet: Monday, May 16, 2005 11:59 PM An: Turbine Users List Betreff: Re: Reusable html table with column sorting and page-at-a-time scrolling
Something like this might help you out. a nice opensource tag library for displaying collections in tables. definitely can give you paging and sorting:
http://displaytag.sourceforge.net/
--- Scott Eade <[EMAIL PROTECTED]> wrote:_If you are using Torque you can use LargeSelect to achieve the record paging. The sorting and filtering needs to be coded manually.
Scott
Rudi Vaum wrote:
>Hi everyone, > >what is the best way to implement this with Turbine/Velocity? >Is there anything already there I could use? >Where could I find examples etc.? > >Thanks >Rudi > > >Example table:
____________________________________________________________________________>Table Title [Add new] [Delete selected] [Filter] [Select all]
___________________________________________________________________________=>Column 1 [sort] Column 2 [sort] Column 3 [sort] Actions
============================================================================>James Brown singer [view] [x] >Jim Morrison rocker [view] [ ] >Murphy - law-writer [view] [x]
===========================================================================_> View page: [<] [1] [2] [3] [>]
___________________________________________________________________________---------------------------------------------------------------------> > >
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
