There is the "sort" attribute of the dtml-in tag.  You'll have to read the DTML Reference for more info on that.

However, it was a little iffy for me once, and now I do something like this:

1. Setup table header with a response back to sort that column.
2. Change the ZSQL method to use that value dynamically.

Maybe not the best/most efficient way, but it works great for my use.

So on your table header, either add forms with submit links, or add a link with query strings.  I usually add a query string, so my table header looks like this:
  <td><a href="" URL0>?sortby=colA">Col A</td>
  <td><a href="" URL0>?sortby=colB">Col B</td>

Then in your ZSQL method, setup an argument for "sortby".  Make sure you name colA or colB exactly like your table columns.  In the method, I create a dtml-if at the end of the query:
Select ........
<dtml-if "_.has_key('sortby')">
   Order by <dtml-var sortby>, LastName
   Order by  LastName


Select ........
<dtml-if "_.has_key('sortby')">
   Order by <dtml-var sortby>

I have LastName there because I always wanted that column to be a second sort. You obviously would have a different one.   There's probably a little more to this I am not thinking of at the moment, but I hope it helps you towards your goal.  You could also get real fancy and add ascending and descending to the mix. (click to sort, click again to sort desc)


On 10/7/05, Thomas Apostolou <[EMAIL PROTECTED]> wrote:
Hello all,
i am using the following to get some data from
and show them in a table:

<META HTTP-EQUIV="Content-Type" CONTENT="text/html;
<style type="text/css" media="screen"><!-- @import
url(/plone.css); --></style>
<style type="text/css" media="screen"><!-- @import
url(/ploneColumns.css); --></style>
<style type="text/css" media="all"><!-- @import
url(/ploneCustom.css); --></style>
<dtml-var standard_html_header>
<table id="sortable" class="listing" summary="Content
listing" cellpadding="0" cellspacing="0">
    <dtml-in expr="GetHeader(sysDSN=sysDSN, usr=usr,
mypass=mypass, sTable=sTable)">
      <th class="">
        <dtml-in sequence-item>
          <dtml-var sequence-item>
    <dtml-in expr="GetData(sysDSN=sysDSN, usr=usr,
mypass=mypass, sTable=sTable)">
      <dtml-if sequence-even>
        <tr class="even">
        <tr class="odd">
      <dtml-in sequence-item>
<!--      <td <input type="checkbox" title=<dtml-var
sequence-item> ></td>-->
        <td><dtml-var sequence-item></td>
<dtml-var standard_html_footer>

But how can i tell the table to sort the column i
click on just like plone does with the members list?

Thanks in advance

Thomas Apostolou

Χρησιμοποιείτε Yahoo!;
Βαρεθήκατε τα ενοχλητικά μηνύματα (spam); Το Yahoo! Mail
διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών

Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Greg Fischer
1st Byte Solutions
Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to