Skip to content

Define toggleFilter default position #2779

@iannesbitt

Description

@iannesbitt

Describe the feature you'd like
Users should be able to set a default slider value for a <toggleFilter>. Currently, toggleFilters are "Off" by default. @robyngit has found the following:

it looks like we only consider the if it's not a "UI filter" (basically a portal or catalog filter model meant to be rendered as an interactive UI element). Commenting out this conditional:

   // if (!this.get("isUIFilterType")) {
   if ($(xml).children("value").length) {
     //Parse the value(s)
     modelJSON.values = this.parseTextNode(xml, "value", true);
   }
   // }

makes the filter default to the in the search, but the toggle appears un-toggled. So there's no way to do it in the config currently, and adding this feature would need to be done carefully so that it doesn't impact the behaviour of our other portal filters. Maybe we could add a preSelectedValue or something via the filter's element??
TLDR: Feature doesn't exist yet, but it's possible to implement

Is your feature request related to a problem? Please describe.
n/a

Additional context
Currently our filter is defined like this:

<filterGroup>
  <label>Search</label>
  <toggleFilter>
    <label>Showing only Maine-funded data and research</label>
    <field>funderName</field>
    <field>fundingText</field>
    <field>funderIdentifier</field>
    <fieldsOperator>OR</fieldsOperator>
    <trueValue>Maine</trueValue>
  </toggleFilter>
</filterGroup>

And the toggle is off by default:

Image

We should be able to set it to be on by default.

Image

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions