Having a button do different action depending on container view


I have a tabbed container that, depending on the chosen view - will update a text box next to it with the relevant text. The code on the text box is:

{{(container_gri.currentViewIndex === 0) ? tbl_gri_requirements.selectedRow.data.req_text : 
   (container_gri.currentViewIndex === 1) ? tbl_gri_recommendations.selectedRow.data.recommendation_text : 
   (container_gri.currentViewIndex === 2) ? tbl_gri_guidance.selectedRow.data.guidance_text : null}}

That works fine.

What I have now done is add another tabbed container where this text box is - so that I can add a read view (simple text box) and an edit view (rich text box).

I want it to be that when the user wants to update the text - they can use the edit view, and then click the save button.

However - this button, right now is attached to only one query. I need it to choose which query to use, to perform the update (I.e. depending on the view of the left hand side tabbed container).

I hope this makes sense - I have added a screen capture to help provide some context.



Hey maillme!

You can trigger multiple queries with same button but based on condition you need.

If you need to trigger update of Guidance text you can add the guidance_update query while using "Only run when" condition and similar for other tabs.

One thing that I would recommend for easier maintenance is using keys vs index of current view - because adding more tabs, reordering them etc. will be harder in the future.

Let me know if this helps!

1 Like

Hey Stevan - that worked a treat! thank you!
It's easy when you know how.
And thanks for the tip on the keys vs index. I changed those also.