Loading data separately for each tab

0
Hi, I’ve a page which has 3 different tabs. Each of these tabs has 3 different entities being shown in a data grid –    Currently, a microflow which shows the above page fetches the data for all 3 entities one by one. However, requirement here is to load the data only for the tab being displayed. When the respective tabs are clicked, then the data for those should be loaded. This can be done by making data source of the data grids as microflows for each of the three data grids in the three different tabs. But, this will make the default search functionality obsolete and i’ll need to write custom search and sort functionality for all three data grids in 3 tabs. Is there any other way to call a microflow on clicking each tab?
asked
3 answers
1

The Mendix tab container attempts to lazy load when it thinks it can. Based on what I recall, I think the tabs will lazy load (i.e., only load when clicked) when they have read-only data in them. If there is a custom widget or an editable data view in the tab, I believe the widget switches to loading that tab right away.

I believe the logic here is like this: if there is editable data, then the tab header might need to show validation bubbles, and therefore needs to load when the page loads.

So, check the network traffic by using Chrome’s dev tools and see if your tabs are already lazy-loading. Depending on your tab design, they might be.

answered
0

Hi Pranav,

If the microflow works for you you can do the following :

Add a parent (dummy) for your entity , Parent 1 – * paybots

Add a dataview inside the tab , datasource microflow.   

In the microflow do the logic you need and connect the paybots with the parent and return the parent object.

Inside the dataview , add your datagrid with xpath  , get the paybots having relation with currentobject which is the parent.

 

Thanks,

Sufian.

answered
0

Hi Sufiyan,
I followed something similar but with a small change. I added a dataview above my datagrid in the tab. In that data view, data source is a microflow which fetches my data from my main db(not mendix_db) and populates it in mendix db. Below the data view, the normal data with XPath as source is there. So basically everytime the tab is clicked, when the data view is loaded, microflow which has the business logic populates the mendix db for the datagrid to show values from.

 

How is it different/better/worse than wrapping it around a dummy entity?

answered