<syncfusion:SfDataGrid x:Name="dataGrid"
AutoGenerateColumns="False"
AutoGenerateRelations="False"
AddNewRowPosition="Top"
ItemsSource="{Binding Path=OrdersDetails}"
NavigationMode="Cell"
ShowGroupDropArea="True">
<syncfusion:SfDataGrid.DetailsViewDefinition>
<syncfusion:GridViewDefinition RelationalColumn="OrderDetails">
<syncfusion:GridViewDefinition.DataGrid>
<syncfusion:SfDataGrid x:Name="FirstDetailsViewGrid" AddNewRowPosition="Top"
AutoGenerateColumns="True">
<syncfusion:SfDataGrid.Columns>
<syncfusion:GridTextColumn MappingName="OrderID" />
<syncfusion:GridTextColumn MappingName="ProductID" TextAlignment="Right" />
<syncfusion:GridTextColumn HeaderText="Unit Price"
MappingName="UnitPrice"
TextAlignment="Right" />
<syncfusion:GridTextColumn MappingName="Quantity" TextAlignment="Right" />
<syncfusion:GridTextColumn MappingName="Discount" TextAlignment="Right" />
<syncfusion:GridTextColumn MappingName="CustomerID" />
<syncfusion:GridDateTimeColumn HeaderText="Order Date"
MappingName="OrderDate"
TextAlignment="Right" />
</syncfusion:SfDataGrid.Columns>
</syncfusion:SfDataGrid>
</syncfusion:GridViewDefinition.DataGrid>
</syncfusion:GridViewDefinition>
</syncfusion:SfDataGrid.DetailsViewDefinition>
<syncfusion:SfDataGrid.Columns>
<syncfusion:GridTextColumn MappingName="OrderID" />
<syncfusion:GridTextColumn MappingName="CustomerID" />
<syncfusion:GridDateTimeColumn Width="200"
HeaderText="Shipping Date"
MappingName="ShippingDate"
TextAlignment="Right" />
<syncfusion:GridNumericColumn HeaderText="Supplier ID"
MappingName="EmployeeID"
NumberDecimalDigits="0" />
<syncfusion:GridTextColumn HeaderText="Ship City" MappingName="ShipCity" />
<syncfusion:GridTextColumn HeaderText="Ship Country" MappingName="ShipCountry" />
<syncfusion:GridCurrencyColumn CurrencySymbol="$" MappingName="Freight" />
<syncfusion:GridCheckBoxColumn HeaderText="Closed" MappingName="IsClosed" />
</syncfusion:SfDataGrid.Columns>
</syncfusion:SfDataGrid> |
dataGrid.AddNewRowInitiating += DataGrid_AddNewRowInitiating;
private void DataGrid_AddNewRowInitiating(object sender, Syncfusion.UI.Xaml.Grid.AddNewRowInitiatingEventArgs e) {
(e.NewObject as OrderInfo).OrderDetails = new ObservableCollection<OrderDetails>();
} |
private void FirstDetailsViewGrid_AddNewRowInitiating(object sender, Syncfusion.UI.Xaml.Grid.AddNewRowInitiatingEventArgs e)
{
var currentItem = (e.OriginalSender as SfDataGrid).GetParentDataGrid().CurrentItem;
var selectedItem = (e.OriginalSender as SfDataGrid).GetParentDataGrid().SelectedItem;
} |
Vijay, this property is misleading. When multiple rows have been expanded then the parent data grid currentitem and selected item always return the last clicked parent row. Which is incorrect.
Example below:
Master Grid
--Parent 1 (last parent row clicked)
----- Detail 1 expanded
--Parent 2
---- Detail 2 expanded
When you ask detail 2 grid what his parents current item is in this case you will get Parent 1. Which is incorrect.
Hi Tim,
We have checked the reported issue “Incorrect parent row when there are
multiple subgrids expanded” and are unable to replicate the issue from our end.
Please find the tested sample and video demo in the attachment.
Please have a look at this sample and let us know if we have
missed any customization done in your application. Otherwise, try to reproduce
the reported issue in this sample and revert to us with the modified sample and
steps to replicate the issue. It will be more helpful for us to find the exact
cause of the issue and to provide a prompt solution.
Regards,
Vijayarasan S
If this post is helpful, please consider Accepting it as the solution so that
other members can locate it more quickly.