I want to make a page that shows a list, and allow that user to click on a column of the list and sort the list by that column. It seems to me that the obvious way to do this is to re-issue the SQL command and use a different 'order by'. First - Is this actually the best way to do this kind of thing in Zope? Second - How do I create a ZSQL script that contains a variable order by? Thanks, Colin -- Colin Fox cfox@crystalcherry.com CF Consulting Inc. GPG Fingerprint: D8F0 84E7 E7CC 5C6C 9982 F1A7 A3EB 6EA3 BC97 572F
there are a couple different ways to achieve the desired results which is a client sorted result list. - use javascript and sort the table on the client side. less load and faster... not so great on the internet where people might turn javascript. - sort the result set in zope using the sort functionality (dtml-in takes a sort attribute) or the sequence.sort in zpt (not sure of the exact name). this has the minor downside of additional processing in zope. - (answering the question ;-) using an order by in the zsql method. make a variable order_by, that gets set in the REQUEST, pick some default value if none is supplied. please be sure of its contents before passing it into the zsql method (otherwise it would be real easy to cause some mischief), use a dtml-var to insert the variable at the end of the order by clause in the zsql method. probably need to add it to the args list as well. hth -kapil On Sunday 12 May 2002 11:41 am, Colin Fox wrote:
I want to make a page that shows a list, and allow that user to click on a column of the list and sort the list by that column.
It seems to me that the obvious way to do this is to re-issue the SQL command and use a different 'order by'.
First - Is this actually the best way to do this kind of thing in Zope? Second - How do I create a ZSQL script that contains a variable order by?
Thanks, Colin
participants (2)
-
Colin Fox -
kapil thangavelu