Here's a fragment from a table that allows sorting by clicking the header
in a dtml method named 'displayTable':

<th><a href="displayTable?sort_key=ID+desc">ID</a></th>
<th><a href="displayTable?sort_key=product">Product</a>
<dtml-in "SQLSelectQuery(sort_key=REQUEST['sort_key'])">

Then feed sort_key into your SQLSelectQuery to use in an ORDER BY clause.

select * from table order by <dtml-var sort_key>

You can change the properties of an object in DTML by callling its
manage_changeProperties method, for example:

<dtml-call expr="foo.manage_changeProperties(bar='New Value')">

will changes the value of foo's bar property to 'New Value'.

There are several ways of getting the effect of assigning variables in
DTML, but it really isn't meant to have a direct way of declaring and
assigning variables.  The way you're trying to use an object's properties
will, I believe, cause problems in the case of simultaneous users, because
it will act as a global variable.


On Mon, 4 Dec 2000, John Cappelletti wrote:

> I am listing the results of a database query using dtml-in. I'd like to
> be able to give the user the option to re-sort the list by clicking on a
> column header. ok... I'm starting small with a form and radio buttons to
> allow the user to specify the sort.
> I've created what I believe to be a global variable for this page using
> the property screen. The variable is to capture the column name for the
> sort. My simple question is how do I assign a value to this variable
> inside of the dtml method! I'm not finding a description of variable
> assignment in the documentation (yeah, I must be missing the obvious).
> Any pointers would be appreciated.  (also, know if anyone has
> implemented interactive sort by column header?)
> thanks,
> John Cappelletti
>   AverStar, Inc.
>   1593 Spring Hill Road, Suite 700
>   Vienna, VA 22182-2249
>   Tel: (703) 827-2606 x 4291 (also, 301 443-7509)
>   Fax: (703) 827-5560
> _______________________________________________
> Zope maillist  -  [EMAIL PROTECTED]
> **   No cross posts or HTML encoding!  **
> (Related lists - 
> )

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to