If I'm reading your question correctly, this is just a timing issue: when you define client-side code and server code in the same event, the client-side code is always executed first. So it's refreshing your dynamicContent
control before it executes the navigator
event.
Move the CSJS code to the onComplete
property of the eventHandler
. This property isn't surfaced in the "pretty panels" for events, so you'll need to navigate directly to the <xp:eventHandler />
tag (either in the Source XML or via the Outline), and you'll find onComplete
listed under All Properties.
Placing the refresh code in onComplete
will ensure that the second refresh doesn't occur until after the first one is completed, which will allow the second target to reflect any changes triggered by the event.
Bonus tip: you can also chain refreshes:
XSP.partialRefreshGet("#{id:div1}", {
onComplete: function() {
XSP.partialRefreshGet("#{id:div2}", {
onComplete: function() {
XSP.partialRefreshGet("#{id:div3}", {
onComplete: function() {
XSP.partialRefreshGet("#{id:div4}");
}
});
}
});
}
});
This allows you to refresh as many targets as you want, but the same rule applies: if you need any of the targets to be "aware" of changes to data or components made within an event, you'll need to trigger the start of the chain in the onComplete
attribute of that event, not as the client-side code of the event itself.