From: Laura McCord [mailto:Laura.McCord@doucet-austin.com]
Yes I have been struggling with this issue this week. The whole big picture is that I need to sort my table which contains the data from a zsql method. But, I have several elements that I need to deal with.
First of all, my page template contains a requested expand/collapse feature using javascript that once a row of data is clicked a new table will expand that contains more related data of that row.
I have to paths:
1)I have javascript already that will sort the visible data in my table but it will not sort the corresponding hidden table that is visible when clicked. So, when I click a row of data the wrong hidden table displays.
For this approach, I would store all the data for the tables in javascript arrays, and use a custom sorting function to sort for the specific order desired for the various table columns. After sorting, you would re-populate the table from the sorted results. It would not matter if some of the data were hidden - choosing whether to display hidden data would work independently from the sorting.
2)This is why I was looking at finding a way to redefine the results by clicking on the appropriate header. So, I wanted each heading on my table to trigger the right zsql method that already contains the desired sort and reassigning it to the batch results and then display accordingly.
Of course, this approach makes the javascript part easy (there isn't any). You would just put a hyperlink in each header that contains the url of the page that uses the correct zsql method. Alternatively, you could use just one page and have the page logic select the right zsql method depending on the contents of the form. What form, you ask? Well, you don't really need a form per se, you can just add the variables you need to the url yourself when you construct the href value. When Zope gets the page request, it will think you submitted a form. The url would look like this - http://your-server-here:8080/url-for-the-page?var_a=valueA&var_b=valueB& ... Cheers, Tom P
So, I don't know which path to continue with and beat with a stick till I get it working.