Deriving/context problem

3
Hi. First I want to compliment Mendix on the new forum and developer's network. It looks great and is also very usefull. Now the family drama I'm facing. This is the model (notice that Child is derived from Parent and Child2 is derived from Parent2): In a data view I have a Child object. Within this data view, there is another nested data view of a Child2 object, which is retrieved over "relation1", a reference to a Child2 object. The above works...both Child and Child2 are viewed properly. Next, I want to add a data grid within Child2's view, which contains all Parent objects that are linked to Child2, either through relation1 or relation2. But no matter what we've tried, we always end up with an empty data grid. This is how it looks like: The problem would be solved instantly if I manage to get the Child2 object as currentObject in the context, but this seems to fail. Can anyone help us out with this one?
asked
2 answers
4

Hi Mustafa,

try setting the context of the datagrid to 'private'; due to the dual references the context meganism will by default constrain over both references. By setting the context of the datagrid to 'private' there will be no constraints whatsoever on that grid

You can then use an Xpath contraint on the datagrid to show the right data

answered
2

Hi Michel,

thanks for your reply. This private context unfortunately didn't help (Child2 isn't the currentobject and therefore it's not possible to make an xpath constraint on the grid based on Child2).

However, after rebuilding the screen and adding an extra reference between the objects "for viewing purposes", I managed to get Child2 in the outer data view. This solved the problem since Child2 is now the currentobject. After setting the context to private, the xpath constraint now works just like it should.

Thanks alot, problem solved.

answered