2

I have a filter list component which is supposed to update the data on the page. Depending on which filters are clicked in this component, I am trying to update my query parameters with it.

Right now, I have the filters working and logging out with correct parameters, but this.transitionToRoute() is incorrect/not working. I think the version of this is not what I'm expecting.

actions: {
  updateQuery: function() {
    //do stuff to get my newParams
    console.log(newParams); //This echoes out nicely
    this.transitionToRoute({queryParams: newParams}); //this returns "not a function"
    return false;
  }
}

The output for newParams is: {status: "KNOWN_TO_FAIL", owner: "spople,kuher,dwoods"} so I know the params are correct, I just don't know how to change the URL parameters and update the data.

Another note which may be another question is that I need this to update only a specific div on the page and not the entire page. Am I barking up the wrong tree?

ntgCleaner
  • 5,865
  • 9
  • 48
  • 86

1 Answers1

3

Components do not have a transitionToRoute method. Your updateQuery action would work fine if it were in a Controller, which does have a transitionToRoute method. You need to pass your action back up to the Controller to trigger the transition.

Without more info, it's hard to judge whether you're barking up the wrong tree or not. Depending on how you have your query params configured in the route (do you have refreshModel set to true?), you're likely to see the the page reload.

casafred
  • 656
  • 6
  • 16
  • I do have my query params set to `refreshModel:true` . Thank you for the insight, should I send the params as a `sendAction` to my controller? – ntgCleaner Jun 01 '18 at 19:45
  • I'd just move your updateQuery action from your component to your controller and then pass that action into your component in your template. Something like this `{{your-component updateQuery=(action 'updateQuery')}}` ought to do it. – casafred Jun 01 '18 at 20:00