I am triggering a route from a smart action, and in this case, I am getting the ID of the selected row, and some constant variable:
var value1 = request.body.data.attributes.ids[0];
var value2 = 'secret';
What if I wanted to now redirect the user, to a different collection (a smartview) and pass some information, which isn’t necessarily part of the targets collection, but should be used with rendering the view, or in the ember js controller. Normally I would assume, I could pass these as path or query parameters, e.g.
response.send({
success : 'Go to a smartview.',
redirectTo : '.../mySmartview/{value1}?bar={value2 }
});
But I don’t see a way for me, inside the component to read what these values were.
How would I renderer the collection mySmartview, and access these two variables?
Unfortunately you cannot access to a collection and precise the Smart View to display this collection.
The collection will always be displayed with the default view configured.
So right now, the best you can do is to configure your collection with the Smart View you’ve created and redirect to this collection at the end of the Smart Action controller (using redirectTo as you did).
You can, of course, add query params to the URL but I am not sure it will be accessible in your Smart View (I didn’t test it).
Thank you for your response. In this case, it is the ladder part of your answer that we are trying to do.
From some collection, a smart action is available.
The logic inside this smart actions route, should redirect the user onto another collection, which is a smart view of course. Note this code is an example,
Our problem is, creating a smart action, and defining the logic in it, works fine. Redirecting to a collection without attching any query parameters, works fine. But how do we pass some information to the route, e.g. as here trying to passing two things: selection and number, and how do we define the collection route, so that it actually is called and can read the parameters?
It seem like a normal feature, to be able to pass a query parameter between routes, so I appreciate both you looking into it, and adding it to a feature request.