Forum OpenACS Q&A: Re: ad_table, OpenACS 4 and XQL files

Collapse
Posted by Nick Carroll on
I can't sort items in a table either.

My sql query in my xql file looks like this...

<fullquery name="msg_sql">
  <querytext>
    select id, summary, datefrom messages
    [ad_dimensional_sql $dimensional_list limit limit]
    [ad_order_by_from_sort_spec :orderby :table_def]
  </querytext>
</fullquery>

My table_def looks like this...

set table_def {
    { id "Report" {id $order} {} }
    { summary "Summary" {summary $order} {<td> \
    <a href="summary?[export_vars -url {id}]">$summary</a></td>} c }
    { date "Date" {date $order} {} c }
}

set messages [ad_table -Torderby $orderby msg_sql {} $table_def]

And in the ad_page_contract I have declared the orderby variable as follows...

{ orderby {date} }

I think it is ordering the table based on the date column by default.

Can anyone tell me where I am going wrong with this?  I still haven't been able to sort columns by clicking on the table header.