I have a DTML method that calls a Z SQL Method and places the results into an HTML table. What I would like to do with the table is make the column headers sort the results in ascending and descending order when they click on the link. I haven't really seen any Howtos or anything in the Zope book that describes or explains what I'm trying to do. If someone could help me with this I'd appreciate it. Thanks, Lucas Vogel _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
MySQL, as most SQL engines has sort capabilities. I use this feature in ZSQL method like this: Parameters : order mode ZSQL script: select field1, field2, field3 from mytable where (...) order by <dtml-var order> <dtml-var mode> Pass as strings to this ZSQL method : order : either 'field1', 'field2', 'field3' mode: 'ascending' or 'descending' The syntax may depend on your db engine. HTH --Gilles ----- Original Message ----- From: "Lucas Vogel" <vogell@yahoo.com> To: <zope@zope.org> Sent: Thursday, January 03, 2002 12:08 AM Subject: [Zope] sorting a table
I have a DTML method that calls a Z SQL Method and places the results into an HTML table. What I would like to do with the table is make the column headers sort the results in ascending and descending order when they click on the link. I haven't really seen any Howtos or anything in the Zope book that describes or explains what I'm trying to do. If someone could help me with this I'd appreciate it.
Thanks, Lucas Vogel
_________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
You can do this on the server or in the client. To do it on the server, when the user clicks on the column header you call a different ZSQL query that returns the data with the sort order you want. Of course, you have to wait for the results and you put more load on the server and database than if you did it on the client. To do it on the client, you have to decide if you want to support standard browsers or just newer ones. In either case you have to use javascript (I'm not considering using java applets or plugins). With IE5.5 and Mozilla, you can do it by using the DOM (Document Object model), with IE5.5 you could write to the table element using Microsoft's version of DHTML. To work with earlier version browsers (i.e., Netscape version 4+), you need to use frames. Send the data in javascript arrays in one frame (or the HEAD element of the frameset), then write the table in the display frame using document.write() to generate the HTML for the table based on the data stored in the javascript arrays. To resort the data, you would rewrite the frame. Cheers, Tom P [Lucas Vogel] I have a DTML method that calls a Z SQL Method and places the results into an HTML table. What I would like to do with the table is make the column headers sort the results in ascending and descending order when they click on the link. I haven't really seen any Howtos or anything in the Zope book that describes or explains what I'm trying to do. If someone could help me with this I'd appreciate it.
participants (3)
-
Gilles Lenfant -
Lucas Vogel -
Thomas B. Passin