mendix refresh issue

0
im using mendix version 10.24.8 and i have a group box inside that i have a list view to show the associates entity of the page parameter and down that i have a create button to create the newly associated entries every time i click on the create button the page jumps to the top how can i avoid this 
asked
2 answers
0

Hello Nithya,

 

Can you share what that button is doing is it calling a microflow or is it directly a create object where you create a new entity on that list view?

answered
0

If I understand correct, every time you click the Create button, the whole page is refreshed, so the scroll position jumps back to the top. To avoid this, you need to refresh only the list section instead of the entire page. You can do this by using a non-persistent helper entity.

 

Here is how you can do it in Mendix 10.24.8, step by step:

 

  1. Create a non-persistent helper entity

     

    • In the Domain Model, create a new entity, for example PageHelper.

    • Mark this entity as Non-persistent.

    • It does not need any attributes; it can be empty.

     

  2. Pass PageHelper as a page parameter

     

    • In the microflow or nanoflow that opens this page, create a PageHelper object.

    • Pass this object as a page parameter when opening the page.

     

  3. Wrap the list view with a data view

     

    • On the page, create a Data view that will wrap your existing List view and the Create button.

    • Set the Data source of this Data view to the PageHelper entity.

    • The structure should be like this:

       

      • Data view (source = PageHelper)

         

        • List view (datasource = association from the original page parameter)

        • Create button

         

     

  4. Refresh only the PageHelper on Create

     

    • On the Create button, call a microflow or nanoflow:

       

      • Create the new associated object as you currently do.

      • Then use Refresh Object on the PageHelper object

         

        • If you use a nanoflow: Activities → Object → Refresh object

        • If you use a microflow: enable “Refresh in client” or use a Refresh Object action

         

       

  5. Result

     

    • Only the Data view (and the List view inside it) will be re-rendered.

    • The full page will not be refreshed, so the scroll position will stay where it is.

     

Summary:

Use a non-persistent PageHelper entity, wrap the list in a Data view using that helper, and refresh only the helper object on Create. This prevents the page from jumping back to the top.

answered