Listen to Data grid within an item/row of a Template grid or List view

1
Consider a scenario where each item/row of a template grid contains a data grid and a data view is set to listen this data grid. Data source: Template grid from database Data grid inside each row of template grid gets a list of objects associated to the template grid row/object A data view listens to above mentioned data grid (Now each row has a data view listening to selection of data grid of that row).  Inside this data view, a list view is placed which gets data from a microflow. The selected/listened data grid object is passed to this data source microflow to retrieve a list for the list view   Data grid placed in each template grid item/row can be given a name like nestedGrid1. Now this name will be same for all the rows of the template grid. I think due to this, the listening data view in each row does not function separately. And selection of data grid object in any row will make all data views showing the same selection as all data views listen to “nestedGrid1”    Required Behavior: I want it to work independently of other rows. In each template grid row, user can select an object from the data grid and the adjacent data view should populate data based on this selection. Now if user makes selections in multiple rows of template grid, all rows should listen to selection separately without having any effect on each other Is there any way to implement it in Mendix? Any workaround or alternate approach? Or it won’t be possible as of now
asked
1 answers
1

The behavior you’re experiencing was addressed in 8.14 by adding an error:
 

  • If a data view is configured to listen to a widget inside a repeatable container (such as a list view or template grid), Studio Pro will now show an error. This prevents the data view in the client from attempting to listen to multiple copies of a widget at the same time, which resulted in undefined behavior. (Ticket 102657)

 

You can achieve the behavior you want, however it will require a little bit of modeling. There are a few ways to accomplish this and they all share a similar theme::

  1. set some assocation on click of a row
  2. use a dataview listening to that association to show the selected row’s data

 

The simplest way would be:

  • add an extra association from the data grid item to the list view item
  • on click of a row, set the association
  • configure your data view to listen to that association

 

You could also create a few different combinations of non-persisted helper entities to keep your persisted data model cleaner, but for all of the solution you’ll use a similar pattern.

answered