TagPage: How the get the active state (is selected) of a tabpage
0
Good evening, My use case is that when a tabpage A of a tabview widget is selected by a user, a microflow should start requesting data from a server. I don't have much experience with Mendix and have no idea how to get the reference of this tagpage from Mendix to query its active status. Currently I am using a microflow timer widget together with the tabview widget on that page. When the microflow timer expires, a microflow checks if the data has been loaded and stored in the Mendix database (data is an entity) or not. If the data is missing, the microflow starts a load request at the backend. This works, but I don't think it's a good way to solve data loading. Is there a better, more elegant way to solve data loading with Mendix ? I would prefer a solution where I could react on atabpage click event. But still could not find such a way in Mendix. Thank you in advance for your help and support. With kind regards, Stephan Franke
asked
Stephan Franke
2 answers
1
Stephan,
You could use a datagrid with a microflow source:
Then on the tab, select Refresh on Show
That should trigger the microflow each time you click on the tab.
Hope that helps,
Mike
answered
Mike Kumpf
1
In the properties of a tab you can do a refresh on show. See the documentation here: https://docs.mendix.com/refguide9/tab-container/#refresh So you could create a datasource loading microflow to retrieve the data. Do note that when loading the page the microflow will already trigger to start loading the data. But when clicking the tab the flow will be again triggered (if the refresh on show option is set to true). But your option is not wrong. Advantage of the microflow timer is that you could trigger a flow only once or refresh after a certain time.