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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Get complex data (JSON) out of Batch-save

Thread ID:

Created:

Updated:

Platform:

Replies:

149850 Dec 11,2019 03:04 PM UTC Dec 12,2019 08:55 AM UTC Angular - EJ 2 1
loading
Tags: Grid
Dennes
Asked On December 11, 2019 03:04 PM UTC

Hello,

when I have a complex column structure like in the Image, the output is still flat like:



(dataGrid.beforeBatchSave)




how do i get the correct structure like defined in the columns?

Thanks!

Pavithra Subramaniyam [Syncfusion]
Replied On December 12, 2019 08:55 AM UTC

Hi Dennes, 
 
Greetings from Syncfusion support. 
 
By default the entered data will be mapped to the format in which the “column.field” has been defined. In your sample we suspect that you have a simple column field (without the dot operator) which might be the cause of the behavior. So if you want the complex structure you need to define the column field with dot(.) operator. Please refer to the below code example, documentation link and sample link for more information. 
 
[component.ts] 
 
@Component({ 
    selector: 'app-root', 
    template: `<ejs-grid #batchgrid id='Batchgrid' [dataSource]='data' allowPaging='true' (beforeBatchSave)="beforeBatchSave($event)" [pageSettings]='pageSettings' 
    [editSettings]='editSettings' [toolbar]='toolbar'> 
    <e-columns> 
      <e-column field='OrderID' headerText='Order ID' width='120' textAlign='Right' isPrimaryKey='true' type="number" 
        [validationRules]='orderidrules'></e-column> 
      <e-column headerText='Order Details' [columns]='orderColumns'></e-column> 
 
    </e-columns> 
  </ejs-grid>`, 
}) 
export class AppComponent { 
    
    public ngOnInit(): void { 
         
        this.orderColumns = [ 
            { 
                field: 'Order.CustomerID', 
                headerText: 'Customer ID', 
                width: 130, 
                textAlign: 'Right', 
                type:"string" 
            }, 
            { 
                field: 'Order.Freight', 
                headerText: 'Freight ($)', 
                width: 120, 
                format: 'C1', 
                textAlign: 'Right', 
                type"number" 
            } 
        ]; 
    } 
    beforeBatchSave(args){ 
      console.log(args.batchChanges.addedRecords[0]); 
    } 
} 
 
 
 
 
 
Please get back to us if you need further assistance. 

Regards,  
 
Pavithra S  


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon