We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

AddNewRow support in Master-Details View

Thread ID:

Created:

Updated:

Platform:

Replies:

131707 Jul 24,2017 02:47 PM UTC Aug 4,2017 05:17 AM UTC WPF 5
loading
Tags: SfDataGrid
Giacomo Galletto
Asked On July 24, 2017 02:47 PM UTC

Hello,

I am trying to achieve the porpuse of adding new details row in a SfDataGrid in Master-Details View, without success.
I am following this guidelines but I can't see any changes on my grid.

Below the xaml code I tried, using auto-generated columns and also non auto-generated columns.
AutoGenerateRelations is set to False on SfDataGrid

Thanks
Giacomo
<syncfusion:SfDataGrid.DetailsViewDefinition>
         <syncfusion:GridViewDefinition RelationalColumn="Emails">
                    <syncfusion:GridViewDefinition.DataGrid>
                        <syncfusion:SfDataGrid x:Name="FirstLevelNestedGrid" AddNewRowPosition="Top" AutoGenerateColumns="True"/>
                        <!--<syncfusion:SfDataGrid x:Name="FirstLevelNestedGrid" AddNewRowPosition="Top" AutoGenerateColumns="False">
                            <syncfusion:SfDataGrid.Columns>
                                <syncfusion:GridTextColumn HeaderText="IdEmail" MappingName="Id" IsHidden="True" />
                                <syncfusion:GridTextColumn HeaderText="IdAnagrafica" MappingName="IdAnagrafica" IsHidden="True" />
                                <syncfusion:GridTextColumn HeaderText="Nome" MappingName="OwnerName" />
                                <syncfusion:GridTextColumn HeaderText="Email" MappingName="Address" />
                            </syncfusion:SfDataGrid.Columns>
                        </syncfusion:SfDataGrid>-->
                    </syncfusion:GridViewDefinition.DataGrid>
                </syncfusion:GridViewDefinition>
            </syncfusion:SfDataGrid.DetailsViewDefinition>

Muthukumar Kalyanasundaram [Syncfusion]
Replied On July 27, 2017 06:56 AM UTC

Hi Giacomo, 
 
Thank you for contacting Syncfusion support. 
 
We have checked your query. We are unable to reproduce reported issue “AddNewRow in Master-Details views are not working” in our end. For your reference, we have attached video and sample in below location. In that sample, we have added AddNewRow in master-detailsview dataGrid, the entered addnewrow value are insert properly in grid. Could you please refer to it. 
 
 
 
Note: The underlying data object must be defined with default constructor. Otherwise, create instance of data object by handling AddNewRowInitiating event. 
 
If you are still facing the issue, could you please revert by modifying sample based on your application and also could you please conform your essential studio version ?. This would be helpful for us to provide an appropriate solution.  
 
Regards, 
Muthukumar K 


Giacomo Galletto
Replied On July 27, 2017 07:48 AM UTC

Hi Muthukumar,

thank you for your very detailed reply, but what you showed in the video and in the demo project you sent me was already in place for me: I am able to add new details row, but only if there already is at least a details row.

My difficulty is to add a new details row relative to a brand new master row: this seems to be not possible even in your demo project.

I attached a video where I'm using your demo project, adding a new master row and then trying to add a details row to it: you'll see there is only the header row in the details grid, no "Add new row" entry.

I'm a total rookie with Syncfusion Essential Studio since I am starting to use it after purchasing the license so apologies if there is something obvious I am missing.


Regards,

Giacomo


Attachment: SfDataGrid_AddNewRow_MasterDetails_ReplyTo_1_4f83e89d.zip

Jai Ganesh S [Syncfusion]
Replied On August 1, 2017 01:16 PM UTC

Hi Giacomo, 
 
You can achieve your requirement for adding a new row for newly added detailsview by wiring the AddNewRowInitiating event and creating an instance of detailsview like below, 
 
this.dataGrid.AddNewRowInitiating += DataGrid_AddNewRowInitiating; 
 
private void DataGrid_AddNewRowInitiating(object sender, Syncfusion.UI.Xaml.Grid.AddNewRowInitiatingEventArgs e) 
{ 
    (e.NewObject as OrderInfo).OrderDetails = new ObservableCollection<OrderDetails>(); 
} 
 
 
Regards, 
Jai Ganesh S 


Giacomo Galletto
Replied On August 3, 2017 07:32 AM UTC

Hi Jai,

thank you, now it work perfectly!


Regards,

Giacomo


Balamurugan Rajaraman [Syncfusion]
Replied On August 4, 2017 05:17 AM UTC

Hi Giacomo 
 
Thanks for the update. 
 
Please let us know, if you need any further assistance on  this. 
 
Regards, 
Balamurugan R 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;