Listening to a Widget - Data Grid - DataView - DataGrid

2
Hello everyone,   I have this following use case.  See entity diagram below: A user has many OrderItem(DataGrid2) related to an Order entity (DataGrid1). Both has too many properties to each other and are displayed using DataGrid. Now the User wants to set a filter, so when the user selects one or more Order objects under the Order tab, the user wants to only see the linked Order Items in the OrderItem  Tab (DataGrid2). Currently I use the following DataGrid1 → DataView(Listens to DataGrid1) → DataGrid2 (placed inside DataView). This combination only shows me the linked objects of the last selected objects in DataGrid1. Basically, the Dataview only outputs, the last selected element. I am not able to make the dependency based on a list.  Does anyone have a solution to this ? Solutions using other widgets are also welcome, just need the usecase (the user able to filter OrderItems list, based on multi selected Order entity objects) to be satisfied.    PS: in both cases (Datagrids) , I used X-path as Datasource
asked
3 answers
0

Hi Jasper,

My demo movie is available on my MendixMagic youtube channel (Youtube explanation)

You can also have a look at my portal on www.medixmagic.com

 

Regards,

 

Andre

answered
0

Hi jasper,

 

In the past I used a helper entity in which you can input the parameters to filter on the order. This enity can than be used as input on two microflows that retrieve the data from order and orderitem. 

I assume you have a client entity and you want to filter based on the selected client. Create a helper entity with an association to the client entity. The tabcontainer should be included in the dataview of the helper.

 

I replicated based on below domain model:

 

 

The page will be something like this:

And with an on change event on the reference selector:

 

 

The DS_CreateHelper functie:

 

The Order retrieve as in tab 1:

 

And the  orderitem retrieve:

 

If the client association is not filled in the helper it is a straight forward retrieve of all order and order items.

If the client association is filled the orderlist en orderitemlist must be based on the associations (see below on orderitem)

 

I have not done any testing, but think something like this should work…

 

You can even expand this by having a listening function to the OrderItem grid. When an orderitem is selected you give only the lines of the selected order. If help is needed I can supply an example.

 

Regards,

Andre

 

answered
0

Hi Andre,

 

Thanks a lot for the wonderful explanation, I will try this in my development branch and will get back to you :) 

 

Greetings

Jasper Lawrence

answered