I've got a table with an onRowDoubleClick action with the following function:
def runAction(self, event):
system.perspective.navigate('op/' + str(self.view.custom.table.selected_data[0].id_review) + '/a')
When the new view opens, I use the id_review param to load up the data to be displayed. The problem is that this binding is running twice. I put a print on it and the id_review is the same both times. Why is it sent twice? I tried to create a new empty view and it's still happening.
This print is triggered twice after double clicking the row.
Thank you for sharing the details regarding the script executing twice when navigating to the new view. I looked into this, and here’s what may be happening:
Possible Reason:
In Perspective, bindings and script transforms can execute multiple times during view initialization. Specifically:
-
Initial evaluation: When the view is first created, all bindings are evaluated, sometimes with default or empty values.
-
Render pass: Once the view is fully initialized and visible, bindings are evaluated again with the correct navigation parameters.
Possible Workaround:
I moved the logic from the binding transform script to the View → Events → onStartup script, and now it only prints once. This might be a workaround to prevent the script from running twice.
Thanks for the reply. I ended up adding a change script to evaluate if the change was intented or not. I also tried the onStartup event but it didn't fit my needs.