Forum OpenACS Development: clear filters

Collapse
Posted by Iuri Sampaio on
on listemplate we can declare filters such as on those samples:

set filters [list \
searchterm [list \
label "[_ project-manager.Search_1]" \
type singleval \
where_clause {$search_term_where}
] \
pm_status_id [list \
label "[_ project-manager.Status_1]" \
default_value [pm::project::default_status_open] \
values { {All "-1"} {Open "1"} {Close "2"} } \
type multival \
where_clause { $status_where_clause } \
] \
subprojects_p [list \
label "[_ project-manager.ShowSubprojects]" \
values { {"[_ project-manager.True]" t } { "[_ project-manager.False]" f} } \
type singleval \
where_clause { $subprojects_where_clause }
] \
]

template::list::create \
-name projects \
-multirow projects \
-selected_format $format \
-key project_item_id \
-filters $filters \
.
.
.

So far so good except for the fact that some items in the filter list have a (clear) button and others just don't, respectively subprojects_p and pm_status_id.

I see no differences between them in the code. I debugged some codes of listtemplate on bug-tracker, project-manager, etc, and i didn't find any reference of how the "clear" button is set up only on specific items of the filter list.

has anyone already ran into this problem?

Collapse
2: Re: clear filters (response to 1)
Posted by Claudio Pasolini on
Hi Iuri,

this is not a problem and is well documented: see template::list::filter::create.

If you set a default value for the filter, this can't be cleared, else the 'clear' link is provided.

Collapse
3: Re: clear filters (response to 2)
Posted by Iuri Sampaio on
iuri you're a lazy bastard

has_default_p: If set to 1, it means that this filter has a default value, and thus cannot be cleared. If not set, the list builder will automatically provide a link to clear the currently selected value of this filter. You only need to set this if you specify a default value in your page's ad_page_contract, instead of through the 'default_value' property below.

thanks claudio