Runtime defined query-params

Hey,

My use case if the following:

  • build a generic sort and filter component
  • have the component show sorts/filters based on the model type
  • refresh the route/params based on the user selection

I would prefer not to enumerate the sort/filters options (in other words query params) on both the model definition and all controller/route that need to filter lists.

Seems that there should be a way to define the query-params at runtime. Would it be possible with the params implementation today?

Thanks, Julien.

This project shows an interesting means of generating a search filter from a model, with the option to dynamically generate your input params: https://github.com/ember-admin/ember-cli-admin#searching

Another technique is via https://github.com/lazybensch/ember-cli-filter-by-query. This could be set up to have the controller’s queryParams simply be “query”, and your dependentKey (model) and propertyKeys (collection of query parameters) set at runtime.

I’ve a hybrid of these techniques, using a search form component to collate the queryParam keys and values, which dynamically creates the fields required to match the needs of the queryParams passed to it. This way I can control which params are included in the filter, and when the filter is triggered. ie: search-form component only passes values that are set if minimum requirements for a search a met, and only when search button is clicked or the Enter key is pressed.