Is creating a non-persistent object and refreshing in client a good way to refresh a data grid with microflow data source?

0
Hi Mendix Community, I have a data grid that uses a microflow data source (DS_GenericXrefDetails_GetFromDB) to fetch records from an external database using the Database Connector module. The records are mapped to a non-persistent entity (GenericXrefDetails), and I want to refresh this datgrid by calling datasource again  and my page that displays datagrid has no context object or page parameter, To refresh the grid, I tried two approaches: ✅ Approach 1: I configured the Refresh button to directly call the same microflow (DS_GenericXrefDetails_GetFromDB). The microflow executes (confirmed via logs), But the data grid does not reflect the updated list. ✅ Approach 2: I configured the Refresh button to call a different microflow that: Creates a new GenericXrefDetails object (This is an object of non- persistable entity) Sets Refresh in Client = Yes Does not commit the object This approach does refresh the grid and shows the updated data. ❓ My Questions: Why doesn’t the first approach (calling the data source microflow directly) refresh the grid? Is creating a non-persistent object and refreshing it in client (without committing) a reliable and recommended way to trigger a data grid refresh? Are there best practices for refreshing microflow-based grids when using external databases and non-persistent entities? Any insights or examples would be greatly appreciated! Thanks, Lasya
asked
1 answers
1

Hey Lasya 

 

Why doesn’t the first approach (calling the data source microflow directly) refresh the grid?

          Because you did only call the microflow you didn't execute the datasource microflow in  that grid. If you want the data to be refreshed in the grid, the grid must execute the microflow, not the user separately.

Is creating a non-persistent object and refreshing it in client (without committing) a reliable and recommended way to trigger a data grid refresh?

           Yes, this is one way to do it. Another one would be to use a java action called Refresh Entity from NanoflowCommons module. This would refresh all objects which belong to your entity in that page you're currently at. 

 

           image.png

 

image.png

 

You can achieve that with a button which triggers a microflow which then refreshes your specific entity by an object parameter (you can retrieve a single object and use the refresh activity)

Are there best practices for refreshing microflow-based grids when using external databases and non-persistent entities?

I mentioned one new at the previous point. But your idea does it good as well!

     

answered