Like for the update function, for every action function there’s a properties object available which contains the field data of that action’s fields.
However, I need the same data as set in the update function’s fields in my action function and I don’t want to set all the fields again for this action.
How can I get the properties object (fields) of the element’s update function in another action?
Thanks for any help in advance!
You can use (as long as your action can’t run before the element is “visible” or live on the screen)
instance.data.variableName = properties.inputFieldName
Then you can pass data between all actions of the same element.
There’s another trick to pass data between elements. I had to do this with my calendar plugin to avoid a circular data issue I was experiencing. Also, it’s just kinda neat.
Element A
window[‘var_name’] = data
ElementB
var data = window.var_name
Going event further,
You can do stuff like
Element A
window[‘var_name’] = instance
Element b
window[‘var_name’].publishState(‘elementA_exposedStateName’, data)
5 Likes
Thank you very much @jared.gibb, this was exactly what I was looking for!