Hi guys, I need a "code behind" sample of how to create a hiarchical grid 3 layers and the third layer binds to one of those bindable thingies EntityQuery<sometable>
So I have the first layer bound to a single row, that drives a datarequest for the next row when expanded, which drives 1 more datarequest for a table.
I can send my whole project if you want, but it's using sql 2012 for the db backend.
Joe
Hello Joe,
I have been looking into your question and I can suggest you initially crate an empty model of data tables and assign them to the XamDataGrid. This way you can initially populate only the data from the first layout. The you can set the ExpansionIndicatorDisplayMode="Always" in the FieldLayoutSettings, so the expansion indicator will be visible all the time and you can handle the RecordExpanding event of XamDataGrid. In the handler of this event you can manually add the data for the second level by populating the child table.
If you need any additional assistance with this matter please feel free to ask.
I am on my grid object and type . and I don't see the ExpansionIndicatorDisplayMode
This is XamGrid (silverlight). I can't find fieldlayoutsettings either.
Where are these?
Thanks, I am able to work on this today more. So far it is working, I will let you know if I have further troubles.
Ok the sample you provided was with only 1 child dataset, which is setup recursively.
Below you will find my grid format:
If you like I will send you my code, but it requires sql 2012 and requires the latest version of INfragistics and it is Silverlight.
Running into a couple of problems the grid puts in ChildItems as it's first expanded record which is unexpected. I trid making the 3rd leaf keyed with "LeafItems" but it was expecting childitems. Which just doesn't work.
Take a look at the xaml to see what fields are required for the 3rd leaf in the tree.
<ig:XamGrid Height="508" x:Name="prdAppSub" DeleteKeyAction="None" RowEnteredEditMode="prdAppAllXamGrid_RowEnteredEditMode" CellEnteredEditMode="prdAppAllXamGrid_CellEnteredEditMode" Width="900" RowExpansionChanging="prdAppSub_RowExpansionChanging"> <ig:XamGrid.Columns> <ig:TextColumn AddNewRowItemTemplateVerticalContentAlignment="Center" AllowCaseSensitiveSort="True" EditorHorizontalContentAlignment="Stretch" EditorVerticalContentAlignment="Stretch" FixedIndicatorDirection="{x:Null}" HeaderText="System" IsFilterable="True" IsFixable="True" IsGroupable="True" IsHideable="True" IsMovable="True" IsResizable="True" IsSortable="True" IsSummable="True" Key="datastr" VerticalContentAlignment="Center" IsReadOnly="True"> <ig:TextColumn.FilterColumnSettings> <ig:FilterColumnSettings FilterCaseSensitive="False" FilterCellValue="{x:Null}" FilterMenuClearFiltersString="{x:Null}" FilterMenuTypeSpecificFiltersString="{x:Null}" FilteringOperand="{x:Null}"> <ig:FilterColumnSettings.FilterMenuOperands> <ig:FilterMenuTrackingObject IsChecked="False" IsSeparator="False" Label="Custom Filters"> <ig:FilterMenuTrackingObject.Children> <ig:FilterMenuTrackingObject IsChecked="False" IsSeparator="False" Label="Equals..."> <ig:FilterMenuTrackingObject.FilterOperands> <ig:EqualsOperand DisplayName="Equals..." Icon="{x:Null}" /> </ig:FilterMenuTrackingObject.FilterOperands> </ig:FilterMenuTrackingObject> <ig:FilterMenuTrackingObject IsChecked="False" IsSeparator="False" Label="Not Equals..."> <ig:FilterMenuTrackingObject.FilterOperands> <ig:NotEqualsOperand DisplayName="Not Equals..." Icon="{x:Null}" /> </ig:FilterMenuTrackingObject.FilterOperands> </ig:FilterMenuTrackingObject> </ig:FilterMenuTrackingObject.Children> </ig:FilterMenuTrackingObject> </ig:FilterColumnSettings.FilterMenuOperands> </ig:FilterColumnSettings> </ig:TextColumn.FilterColumnSettings> <ig:TextColumn.SummaryColumnSettings> <ig:SummaryColumnSettings /> </ig:TextColumn.SummaryColumnSettings> </ig:TextColumn> <ig:TextColumn AddNewRowItemTemplateVerticalContentAlignment="Center" AllowCaseSensitiveSort="True" EditorHorizontalContentAlignment="Stretch" EditorVerticalContentAlignment="Stretch" FixedIndicatorDirection="{x:Null}" IsFilterable="True" IsFixable="True" IsGroupable="True" IsHideable="True" IsMovable="True" IsResizable="True" IsSortable="True" IsSummable="True" Key="Id" VerticalContentAlignment="Center" Visibility="Collapsed" IsReadOnly="True"> <ig:TextColumn.FilterColumnSettings> <ig:FilterColumnSettings FilterCaseSensitive="False" FilterCellValue="{x:Null}" FilterMenuClearFiltersString="{x:Null}" FilterMenuTypeSpecificFiltersString="{x:Null}" FilteringOperand="{x:Null}"> <ig:FilterColumnSettings.FilterMenuOperands> <ig:FilterMenuTrackingObject IsChecked="False" IsSeparator="False" Label="Custom Filters"> <ig:FilterMenuTrackingObject.Children> <ig:FilterMenuTrackingObject IsChecked="False" IsSeparator="False" Label="Equals..."> <ig:FilterMenuTrackingObject.FilterOperands> <ig:EqualsOperand DisplayName="Equals..." Icon="{x:Null}" /> </ig:FilterMenuTrackingObject.FilterOperands> </ig:FilterMenuTrackingObject> <ig:FilterMenuTrackingObject IsChecked="False" IsSeparator="False" Label="Not Equals..."> <ig:FilterMenuTrackingObject.FilterOperands> <ig:NotEqualsOperand DisplayName="Not Equals..." Icon="{x:Null}" /> </ig:FilterMenuTrackingObject.FilterOperands> </ig:FilterMenuTrackingObject> </ig:FilterMenuTrackingObject.Children> </ig:FilterMenuTrackingObject> </ig:FilterColumnSettings.FilterMenuOperands> </ig:FilterColumnSettings> </ig:TextColumn.FilterColumnSettings> <ig:TextColumn.SummaryColumnSettings> <ig:SummaryColumnSettings /> </ig:TextColumn.SummaryColumnSettings> </ig:TextColumn> <ig:TextColumn Key="Level" Visibility="Collapsed" IsReadOnly="True" /> <ig:TextColumn Key="ApplicationSystem" Visibility="Collapsed" IsReadOnly="True" /> <ig:ColumnLayout Key="ChildItems" HeaderVisibility="Collapsed" > <ig:ColumnLayout.Columns> <ig:TextColumn Key="datastr" IsReadOnly="True" /> <ig:TextColumn Key="Id" Visibility="Collapsed" IsReadOnly="True" /> <ig:TextColumn Key="Level" Visibility="Collapsed" IsReadOnly="True" /> <ig:TextColumn Key="iLevel" Visibility="Collapsed" IsReadOnly="True" /> <ig:TextColumn Key="ApplicationSystem" Visibility="Collapsed" IsReadOnly="True" /> <ig:ColumnLayout Key="ChildItems" HeaderVisibility="Collapsed"> <ig:ColumnLayout.Columns> <ig:TextColumn Key="ID" Visibility="Collapsed" /> <ig:TextColumn Key="EqId" Visibility="Collapsed" /> <ig:TextColumn Key="ApplicationSystem" Visibility="Collapsed" /> <ig:TextColumn Key="ApplicationClass" Visibility="Collapsed" /> <ig:TextColumn Key="ApplicationType" /> <ig:TextColumn Key="ApplicationDescription" /> <ig:TextColumn Key="ApplicationComment" /> <ig:TextColumn Key="OEMProductLine" /> <ig:TextColumn Key="ProductTypeSingular" /> <ig:TextColumn Key="PartNumber" /> <ig:TextColumn Key="ProductAttribute" /> <ig:TextColumn Key="ProductComment" /> <ig:TextColumn Key="NumberRequired" /> <ig:TextColumn Key="Sequence" /> </ig:ColumnLayout.Columns> </ig:ColumnLayout> </ig:ColumnLayout.Columns> </ig:ColumnLayout> </ig:XamGrid.Columns> <ig:XamGrid.SelectionSettings> <ig:SelectionSettings RowSelection="Multiple" /> </ig:XamGrid.SelectionSettings> <ig:XamGrid.RowSelectorSettings> <ig:RowSelectorSettings Visibility="Visible" EnableRowNumbering="False" /> </ig:XamGrid.RowSelectorSettings> <ig:XamGrid.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/psLite;component/Assets/Styles.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </ig:XamGrid.Resources> <ig:XamGrid.EditingSettings> <ig:EditingSettings AllowEditing="Cell" IsOnCellActiveEditingEnabled="True" IsEnterKeyEditingEnabled="True" /> </ig:XamGrid.EditingSettings> <ig:XamGrid.AddNewRowSettings> <ig:AddNewRowSettings AllowAddNewRow="None" /> </ig:XamGrid.AddNewRowSettings> </ig:XamGrid>
my code download location:
code:
https://bwstage.gates.com/goodreasons/pslite.7z
database
https://bwstage.gates.com/goodreasons/pslite.bak
Hello foxjazz,
Thank you for providing the application and the database. I succeeded in running them and on my side the hierarchy gets populated for all of the 3 levels, therefore I am not sure that I understand your requirements. Would you please provide me with some details what is the expected behavior that you are trying to achieve and some steps to reproduce the issue.
Thanks in advance.
That's GREAT you have it working.
On the left side please select acura 2012, light car, then TL or something and then:
on the right hand side you will see the applications. Selectec the hiarachical dropdown for one of those, and it will give childitems, select that and it will give more items. The child items shouldn't appear. You can debug the grid with the event on expanding. And eventually we want to see all the applicaitons (at the third level in the grid) that belong to the vehicle selected on the left. The hiarchical grid is where I am having problems, not the Tree. The tree works great as you have provided very good instructions on how to make that work.
Let me know if you need more info.
Hello,
I am glad that you have solved your issue.
If you need any further assistance, feel free to ask
So I got further along, but I can't get the grid to display the LoadOperation<AppAll> where I set LeafData.
So I couldn't get an expansion box because I can't instatiate an empty LoadOperation due to no constructor.
However I am setting LeafData to the LoadOperation and I am calling the loadoperation which should be getting some data.
I made the call on the Cell_Clicked as there was no expansion indicator available.
Any ideas on what to do to get this to show up?
Latest of my code is posted: https://bwstage.gates.com/goodreasons/pslite.7z
OK editing this because I got further in my adventure. Now all I need is to figure out how to change an ObservableCollection to IEnumerable.
Ok even though I got a lot further, I am struggling with setting the last layer into the grid Observable<AppAll>
My current modifications have been updated. Any ideas why it isn't working as expected?
And one more question. If I have a table IEnumerable and the first two columns are ordered. Shouldn't the grid have an option to automatically make like a hiarchical grid distincting the first colum, then the second?
Thank you for the details. You can see that xamGrid shows all of the public properties in the data objects, and that it automatically figured out that there is data in related collections and added child column layouts. By default, xamGrid treats any property that exposes a type that implements IEnumerable as a child ColumnLayout object, so I believe that this cause the extra layout that you are getting. In order to disable this behavior you can set AutoGenerateColumns property of the XamGrid to false. For additional reference about this you can check:
http://help.infragistics.com/Help/NetAdvantage/Silverlight/2011.2/CLR4.0/html/xamGrid_Auto_Generate_Columns.html
Furthermore if you define a ColumnLayout that contains a key that does not exist in the data source, xamGrid will simply ignore it. Therefore please make sure that the Keys that you have set for the ColumnLayouts can be properly mapped to properties from type IEnumerable.
http://help.infragistics.com/NetAdvantage/Silverlight/2012.1/CLR4.0/?page=xamGrid_Columns.html
http://help.infragistics.com/NetAdvantage/Silverlight/2012.1/CLR4.0/?page=xamGrid_Defining_Hierarchical_Layouts.html
If you need any additional assistance with this please feel free to let me know.