Hello,
im using XamDataGrid hierachical through binding its DataSource to a hierachical DataSet, and provide they FieldLayout + RelationField for each FieldLayout/Table, dynamically. (I generate the grid all code-behind, no xaml. (Dynamic relations & columns.))
I dont want the relation headers "relation6" / "relation7" / ..
My problem is, i add multiple child-relations for a table - used by different rows. The grid now displays every relation for every row, even if its empty for this row. How should i provide the relations? Or Hide the relation-groups/headers? (hide relation field?)
GreetingsiA. Kits
I don't think I understand all that well. I think it mostly has to do with the fact that I'm not very good with DataTables :(. Would it be possible for you to send me a sample of what you have so far and I can try to make it work the way you need it? It would be nice to see how your DataTable and FieldLayouts are generated.
Hi Rob,
unfortunately this doesnt seems to fit my need.
I dont want the expansion-indicator, i dont want the empty space of it - if i hide the header, i dont want the indent.
I got 1 table with 2 rows:
- Row A needs relation AR
- Childs AA got relation to AAR
- Row B need relation BR
- Childs BB got relation to BBR
Row A doesnt need to know, show or do anthing with relation BR.
Row B doesnt need to know, show or do anthing with relation AR.
I hope you can understand what i need.
PS: Should i create a FieldLayout for every row? Is that even possible?
Hi Joerg,
Actually a colleague pointed out that instead of removing the field in order to remove the ExpandableFieldRecordPresenter, you can set the ExpandableFieldRecordHeaderDisplayMode property in the XamDataGrid.FieldSettings. This property controls how the ExpandableFieldRecordPresenters are displayed.
Those ExpandableFieldRecordPresenters are there because your FieldLayout has more than one Field for the child data. When there is more than one Field it displays these presenters so the user can tell which is which. So there are two things that you can do in order to remove the ExpandableFieldRecordPresenters that you don't want to see. The first is to set the Visibility on the Field that represents that relation in your FieldLayout. If you set it to Collapsed then the child data will not be displayed. If you do this for every relation Field except the one you want then you will only see the single child set. You will still see the ExpandableFieldRecordPresenter for it though since the FieldLayout has more than one Field for child data.
This leads to the second option: remove the Field from the FieldLayout all together so there is only one relation Field. If there is only one relation Field then no ExpandableFieldRecordPresenters will be used and expanding the parent record will immediately show the single set of child records.
I have attached a basic sample that shows what I mean. If you run the sample as is, you will see two relation Fields: "ChildRelation1" and "ChildRelation2". Each has its own ExpandableFieldRecordPresenter. Now go to the code behind and into the CreateLayouts() method. You will see some commented out code with comments above them. The first one sets the Visibility on the Field that represents one of the child relationships. Comment this back in so it hides the field and then rerun the sample. You will see that when you expand the first record it still shows an ExpandableFieldRecordPresenter for "ChildRelation2". Go back to the code and then use the second commented out line. This removes the Field entirely. Rerun and you will see that no ExpandableFieldRecordPresenter is shown and it immediately shows the child data.
So basically you have to do the same thing in your application. If you aren't using those Fields, or you don't want to show their data then you should just remove the relation Field from your FieldLayout.
- My childs are in seperate Tables, because they again can have own childs. - I generate a FieldLayout for each table including a field for its children (named of child-table).
My source data is one table referencing itself with ParentID -> ID. Its nested depth is dynamically. (It can be several levels)
Any hints on this?