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
Essential JS2

Syncfusion jQuery based widgets are no longer in active development. Switch to our pure JavaScript based next generation Essential JS 2 library.

How to get newly inserted row data from endadd event in grid?

Thread ID:

Created:

Updated:

Platform:

Replies:

145946 Jul 15,2019 01:53 PM UTC Jul 17,2019 09:19 AM UTC jQuery 3
loading
Tags: ejGrid
Muhammad Zeshan
Asked On July 15, 2019 01:53 PM UTC

I am trying to get newly inserted rowdata(cell values) from endadd event of grid and trying to send it to webapi. I look every where in documentation but not find any way to process the args parameter. Below are code snippets.

var dataManager = ej.DataManager({
url: "http://localhost:1895/api/customer",
crossDomain: true,
adaptor: new ej.WebApiAdaptor(),
offline: true,
});


$("#grid").ejGrid({
dataSource: dataManager,
//allowFiltering: "true",
allowResizing: "true",
endAdd: senddatatoserver, // endadd event handler
    allowGrouping: "true",
isResponsive: "true",
allowResizeToFit: "true",
allowPaging: "true",
allowScrolling: "true",
allowSorting: "true",
allowReordering: "true",
recordClick: function getInfo(args) {
if (args.target.classList.contains("e-rowcell")) {
console.log(this.ej2_instances[0].getRowInfo(args.target)); // for getting row info based on click
}
},
allowMultiSorting: "true",
allowSearching: "true",
enableResponsiveRow: "true",
contextMenuSettings: {enableContextMenu: true},
enableHeaderHover: "true",
enableAltRow: "true",
enableRowHover: "true",
scrollSettings: {width: screen.availWidth},
pageSettings: {pageSize: 10},
editSettings: {allowAdding: "true", allowDeleting: "true", allowEditing: "true"},
toolbarSettings: {
showToolbar: true,
toolbarItems: [ej.Grid.ToolBarItems.Add, ej.Grid.ToolBarItems.Edit, ej.Grid.ToolBarItems.Delete, ej.Grid.ToolBarItems.Search, ej.Grid.ToolBarItems.Update, ej.Grid.ToolBarItems.Cancel]
},

}); 


var func = function senddatatoserver(args) {
$("#dialog").ejDialog(
{
actionButtons: ["close"],
title: "Record added",
}
);
$("#addcontent").text("Row Inserted Succesfully" + a);
//how to process args to get newly inserted row and send to the webapi as post request.

};


Farveen Sulthana Thameeztheen Basha [Syncfusion]
Replied On July 16, 2019 12:50 PM UTC

Hi Muhammad, 

Thanks for contacting Syncfusion Support. 

Query#:- I am trying to get newly inserted rowdata(cell values) from endadd event of grid and trying to send it to webapi. 

We have checked your query and by default while using webAPI adaptor after hitting the post request, endAdd method will get trigger. You can get the inserted data after the returning the post request.  So before proceeding your query we need some more additional details to find the cause of the issue. Share us the following details. 

  1. For which purpose you need to send inserted data to server side.(Do you need to perform any operations on server end).
  2. Exact scenario you need to achieve.

Regards, 

Farveen sulthana T 


Muhammad Zeshan
Replied On July 16, 2019 01:05 PM UTC

Scenario: When I insert data in grid it just add in grid no post request is made to webapi. I want to achieve, getting data from endadd event(newly inserted row) and send it to webapi to insert in database.

Problem: I don't know how to get values of newly inserted row from args object in endadd event.


What solution I want: Just show me way how to get newly inserted row data of grid in endadd event via event args object.

Thankyou.

Farveen Sulthana Thameeztheen Basha [Syncfusion]
Replied On July 17, 2019 09:19 AM UTC

Hi Muhammad,  
 
 Query#:- What solution I want: Just show me way how to get newly inserted row data of grid in endadd event via event args object. 
 
 You can get the newly inserted row data on endAdd event through args.data or else from args.rowData. 
 
 Refer to the screenshot:- 
   
 
 
Please get back to us if  you need any further assistance. 
 
Regards, 
Farveen sulthana T 
 


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