How to Display Objects on Cart Page Without Commit Action in the microflow

0
  I'm currently facing a dilemma in my Mendix application. I want to display objects on the cart page without executing a commit action. However, despite my efforts, I haven't been successful in achieving this. Does anyone have any insights or suggestions on how I can display objects on the cart page without executing a commit action? Any alternative approaches or best practices would be greatly appreciated. and what should be data source of the cart page?  Thank you for your help!  
asked
1 answers
0

You do not have to commit objects to display them but they do need to be available in the cache on the client. Extrapolating from your question I assume your domain model would look something like this:

 

image.png

 

If you have your shopping cart associated to your session, it won't be removed from the client cache, and any ShoppingCartItems you add to your ShoppingCart will therefore remain in cache as well. You can then retrieve the shopping cart and its items on a dedicated page. The page would accept a ShoppingCart as parameter, which you would display in a DataView. You can then use any of the collection widgets (ListView, DataGrid, etc) to display the ShoppingCartItems using the over association option.

 

Please note that this design will hold the non-committed objects in memory for as long as the browser tab is open. Once you close your browser tab, the data is gone.

answered