I’m trying to go from a summary of orders page to a detail / edit orders page. I’m trying to do this with an embedded URL query using path_calc.
The named actions has several steps. In the step before the path action, I use a function to set the model with the relevant data needed. I know that it’s populating the model correctly. The next step is a path function where I’m attempting to concatenate those inserted model fields to the path using path_calc. I keep getting “undefined” when I attempt to add the model fields.
"path_calc": "'/edit/orders/DEVmodalEntry?distribution=' + model.editOrders.distribution"
The resulting path that comes out is:
Not sure what I’m doing incorrectly here. Again, I know the function step where I insert the data into the model is working; if I remove the path and look at the model, the inserted model entries are there (i.e. editOrders.distribution exists).
I still can’t get this to work. I’ve now tried running a utilityhook from the originating page, collecting the data and transferring it to the app model, using a path to go to the new page, and loading the model from the app model. This works, but the new page refuses to show the data. However, if I click on “dev tools”, the data magically shows up and the form processes the data. Is there a way to force the page to “refresh”?
_calc 's can only evaluate in the context of the main page schema and NOT in named actions.
If this action is in a namedAction then it will not evaluate as you would expect.
In these cases use a
function key in the action and modify the path that way.
action.options.path = '/somepath?key=' + model.somePathValue
@delfs That seems to have done the trick with using it as a query. It’s a somewhat complex query with multiple keys being passed which will make the URL quite long. The other method I was looking into (running a utilityHook from the parent page and passing the data) appeared to work except the form wouldn’t show the data unless I clicked “dev tools”. Is there a way to force it to “refresh”? I suspect something similar is happening when I click “dev tools”.
Without seeing the specifics it’s hard to say… But generally if you were finding something is not updating it is often because the key that needs to monitor it does not exist yet. You can often resolve these types of issues by setting the key in your default data model first even if it is for an empty string or empty object.