I’ve recently had a reason to schedule one event in a data binding to happen after another which I achieved at code level with .then()…
… and I was wondering if this is available in the menu system as I couldn’t seem to find it!
I’ve recently had a reason to schedule one event in a data binding to happen after another which I achieved at code level with .then()…
… and I was wondering if this is available in the menu system as I couldn’t seem to find it!
Can you explain what are you trying to achieve exactly?
Then is used when you have a condition ... if some condition ... then ...

Yes, this is my code:
dmx-on:click="add_business.load({}).then(businesses.load())"
I only want businesses to load when add_business has completed.
Without the .then(), the two seemed to happen concurrently so businesses did not load the new business. as it was still being created.
With the .then() it works okay…
Well that is not really a correct use … if you want a server action to load after another one loaded successfully then use the dynamic events.
Select the first server action, select dynamic events > data > success > and load your second server action. Use the UI for this, don’t try to adjust .then in your code manually.
But this is an onClick event on a button so there is no Data section under dynamic events…
<button class="btn button_link text-right" id="b_add_new_business" dmx-on:click="add_business.load({}).then(businesses.load())">Add a new business</button>
Isn’t it always required to reload the business when the add_business has been executed?
Yes, that is what I am trying to achieve…
So to guarantee that, should I be creating a form so I have an onSuccess option?
Is there anything in a Data binding that guarantees one action step happens after another has completed?
Select your server action, add new dynamic event > data > success > and load your second server action.
The success event is available under DATA.
as long as the form is correct there should not be any issue on putting the reload on the ‘Success’ action. This is from my experience of doing it this way
Yes, but as you can see from my code, I’m doing this as a get rather than a post, so I don’t have a form… and therefore there is no Data section in the Dynamic Events area of my button… look:
So my question is: can I guarantee a sequence of events in the On Click Add Actions menu:
I am referring to the server action itself, not to your button.
Just scroll to your server action in the App Structure and select it! Not through the click event …




Oh wow…




I didn’t know you can do that!
That opens up all sorts of possibilities…
THANK YOU TEODOR!
That’s actually the correct way to run several actions on XXXXX event, one after another.