Forum OpenACS Development: Re: Res: Re: listbuilder: export url-vars for orderby/filters?

Collapse
Posted by Brian Fenton on
Hi Alexander

first of all, you probably don't want to call template::list::filter::create directly. Instead you should have a template::list::create with a -filters e.g

set filter ""
append filter { parameter_super_scheme_id {
                  where_clause_eval {
                    set where {and 1 = 1}
                    if { $parameter_super_scheme_id != 0 } {
                      set where "and abc.super_category_id = :parameter_super_scheme_id "
                    }
                    set where
                  }
                }
}
append filter { parameter_scheme_id {
                  where_clause_eval {
                    set where {1 = 1}
                    if { $parameter_scheme_id != 0 } {
                      set where " abc.category_id = :parameter_scheme_id "
                    }
                    set where
                  }
                }

template::list::create \
  -name $list_name \
  -multirow tickets \
  -elements $elements_list \
  -orderby $orderby_list \
  -groupby $groupby_list \
  -filters $filter

You have to pass in to ad_page_contract your filter parameters (parameter_super_scheme_id and parameter_scheme_id in my case). And finally, remember to add [template::list::filter_where_clauses -name $list_name] to the end of your SQL statement that you use to build the multirow.