I have four values of which two are exposed by "Limit list to selected items", plus "Any". Radio buttons are used by "Force single". I need a way to set the default value for the filter. Can this be done? E.g.:

Any
Option A <- default when view is loaded
Option B

Thanks for this module.

Comments

futurist’s picture

It's still trickier, I just noticed, because "Any" also returns items that are outside the selected set. I need "Any" to only list items from Option A and Option B. Otherwise I will have to turn off "Optional", which will let users see only items from either Option A or Option B. :(

mikeker’s picture

futurist,

This is an excellent use case. Thanks for reporting it.

I'm sorry to say that for the original issue, BEF can't help you right now. In the "Configure Filter" dialog, Views uses the selected items for two things: the selected value as well as specifying a range of items to expose. It would take patching Views to present a default value dropdown when "Limit list to selected items" is selected. I don't have time to work on that in the near future, but I'll keep this issue assigned to me.

Your second issue ("Any" returns items outside the "Limit list to selected items") looks like an issue with BEF. Let me investigate...

Thanks.

mikeker’s picture

Assigned: Unassigned » mikeker
Andrew Gorokhovets’s picture

subscribing

dddbbb’s picture

Subscribing.

dddbbb’s picture

Is it possible to just have 'Any' set to be the default filter? That's all I need.

PI_Ron’s picture

Same here.

I filter 'things to do' content type by 'Paid' or 'Free', but I need '' to be selected by default, is this possible?

mikeker’s picture

Status: Active » Needs work

OK, there's a couple of issues here:

  1. You cannot set a default value if you have more than one values selected (eg: if you were using the "Limit list to selected items")
  2. If you have "Limit list to selected items" checked, selecting "Any" returns rows outside of the limited selection
  3. When rendering as radio buttons, no options are selected by default

Unfortunately, the first two are out of my control -- those are issues with Views. I'm not sure if #2 is a bug in Views or not. I'll poke around and report it if I can't find anything. #3 I can fix: if no #default_value is specified the Any option (if it exists) is selected by default. Keep in mind that this is strictly a display fix as having nothing selected is the same as have Any selected.

mikeker’s picture

Oh, I should mention that this is all with respect to Views 2.x. I have't looked into this in Views 3.x...

dddbbb’s picture

Re point 3: This isn't what I get.

Whether I render as radio buttons or select list, I get the first option (after "Any") selected by default. That's what I thought was a little strange; defaulting to "Any" makes perfect sense to me and I was surprised that it doesn't seem to work like that.

mikeker’s picture

Status: Needs work » Closed (won't fix)

Cleaning out the issue queue -- I won't be making any more changes to the 6.x-1.x branch.