Batch Operation Page Data Not Refreshing After Reopening

0
I am currently developing a MyTask page that supports batch operations.However, not all records can be processed together, so I need a controllable row-selection mechanism.Current DesignMy main entity is App.I created a helper non-persistent entity (App_Check) for row selection.The relationship is: App * --> 1 App_CheckWhen the page is opened, an App_Check object is created for each App.All generated App_Check objects are associated with another helper non-persistent entity (Help).A Data Grid is bound to the App_Check objects through the association between Help and App_Check.This allows me to implement custom row selection logic for batch processing.IssueAfter a batch operation is completed:I delete both non-persistent entities (App_Check and Help).I execute Close Page / Close All Pages.In the same microflow, I immediately reopen the MyTask page.However, the page data is not refreshed correctly.Observed behavior:Sometimes none of the records are updated.Sometimes only part of the records are updated.Switching between pages multiple times does not consistently refresh the data.Pressing Ctrl + F5 in the browser immediately shows the correct and latest data.This makes me suspect that some client-side cache or page state is being reused.QuestionWhat is the recommended way to completely refresh or invalidate the page/client cache in this scenario?Specifically:How can I ensure that all objects displayed on the page are reloaded from the server when reopening the page?Are there any known caching behaviors for Data Grid, Data Grid 2, associations, or non-persistent entities that could cause this?Is there a way to force Mendix to discard the existing page state before reopening the page?Any suggestions or best practices would be greatly appreciated.Thank you.
asked
1 answers
0

Hi Wang,


Based on your screenshots, I suspect the issue is related to the lifecycle of your non-persistable helper objects and the Data Grid 2 data source, rather than browser caching alone.


Your current flow deletes GridCheck_HelpList and Help_Pagination, closes the page, and immediately opens MyTask again. Since your grid displays App_Check objects through an association with these helper objects, reopening the page does not necessarily guarantee that the grid is using a completely new set of helper objects.


Mendix maintains non-persistable objects in the client state, and page parameter objects can remain available for browser history even after a page is closed.


Recommended approach

1. Create fresh helper objects when reopening the page

Instead of relying on deleting the existing helpers and reopening the page, create a new Help_Pagination object and new GridCheck_Help objects after the batch operation.

  • Create a new Help_Pagination object.
  • Retrieve the latest App records.
  • Create fresh GridCheck_Help objects for the records.
  • Associate the helper objects with the new Help_Pagination object.
  • Open MyTask using the newly created Help_Pagination object as its page parameter.

This ensures that the page starts with a fresh selection context instead of relying on previously displayed helper objects.


2. Check the Data Grid 2 data source

Your screenshot shows that Data Grid 2 uses an association-based data source.

If you modify the underlying records during batch processing, make sure the grid's data source is reloaded after the operation. Mendix documents that widgets using data sources may continue displaying previously loaded data unless the relevant data source is refreshed.

If you use a microflow to perform the batch operation, check the Refresh in client setting on the relevant Commit/Delete activities where available.

For nanoflows, this setting is not configurable on Delete Object; changes are reflected in the client as the nanoflow executes.


3. Avoid relying on Ctrl + F5

The fact that Ctrl + F5 displays the correct records suggests that the issue may be related to client-side state or data-source refresh timing. However, it does not prove that browser caching is the root cause.

You should be able to handle this through the application's object lifecycle and refresh logic without asking users to reload the browser manually.


4. Test the following change first

I would start by changing the end of your batch-operation flow to:

Batch operation completed
        |
        v
Retrieve latest App records
        |
        v
Create NEW Help_Pagination
        |
        v
Create NEW GridCheck_Help objects
        |
        v
Associate helper objects
        |
        v
Show MyTask with the NEW page parameter

Do not reuse the old Help_Pagination or its associated selection objects.

If the grid still displays stale data, the next step is to inspect the Data Grid 2 data source and verify whether it is being executed again when the page opens.

Reference: Mendix documentation: Non-Persistable Objects and Garbage Collecting


Hope this helps.

answered