My ideas:
- Place your 2nd data view (MyDocument) within your 1st one (MyDocRef)
- Create an association 1-1 between MyDocument and MyDocRef called “SelectedDoc” for example
- Use this association as DataSource for your 2nd data view
- Add an OnChange microflow (or OnLeave) on your dropdown.
In this event microflow, set the association with the selected document, and refresh your page.
Seems to me that all you need is a nested data view
https://docs.mendix.com/refguide/entity-path-source#2-properties
Drag the MyDocument dataview inside the dataview and select the path to the context object just like you did in the dropdown
You can set an empty entity message to make it look nicer
https://docs.mendix.com/refguide/data-view#4-4-empty-entity-message
I actually figured it out. I placed a Data grid widget and gave it’s source as my entity which has my documents. Filled it automatically and deleted the unnecessary buttons. I placed a Data view inside the grid and chose ‘Listen to widget’ as it’s Data Source and selected the grid from the drop down. Then I placed the Document viewer inside the Data view. When I choose a particular pdf in the Data Grid, that pdf gets opened in the Data View.