25699

Ag-Grid edit data and sending to server

<h3>Question</h3>

Ag-grid on angular able to create grid fetching data from local json file. On editing any row how to save that data and then send to server or possibly local json file ??

In short Ag-Grid how to save row data after edit and send to server on click of Submit button. Anyone if implemented this on Javascript please comment, will try to use that on angular

Please let me know if there is any other best option apart from ag-grid to implement this functionality


<h3>Answer1:</h3>

If you want to listen to specific changes to a particular row, you can make use of the onCellValueChanged, or onRowValueChanged event bindings when defining the ag-grid component on your component template.

<ag-grid-angular . . (gridReady)="onGridReady($event)" (onRowValueChanged) = onRowValueChanged($event) >

and on your component.ts, the onRowValueChanged method will be fired every time you make any changes

export class YourComponent { private gridApi; private gridColumnApi; . . onRowValueChanged: function(event) { console.log(event) // access the entire event object console.log(event.data) // access and print the updated row data const gridData = this.getAllData(); // api call to save data } getAllData() { let rowData = []; this.gridApi.forEachNode(node => rowData.push(node.data)); return rowData; } onGridReady(params) { this.gridApi = params.api; this.gridColumnApi = params.columnApi; }

来源:https://stackoverflow.com/questions/54536511/ag-grid-edit-data-and-sending-to-server

Recommend

  • Ag-Grid edit data and sending to server
  • Ping error return always equals 0
  • Angular 2 Typescript: TypeError: this.validator is not a function
  • How can I print out all lines of a file containing a specific String in unix
  • Find nearest known location: Google Reverse Geocoding
  • Django email message as HTML
  • Are there possible approaches to map signal handling (c library) into a c++ exception?
  • Stop or Detection dll injection loadlibrary
  • How to scroll the horizontal scrollbar in an iFrame from the parent frame?
  • Executing bash convert commands asynchronously
  • React Current Image in Image Gallery
  • ASP.NET MVC 3 ListBox validation
  • Bulk loading into PostgreSQL from a remote client
  • getting the values of checkboxes in a checkboxlist control
  • the IBM_JAVA error for running jobs in Hadoop 2.2.0
  • Override all shipping costs for a specific shipping class in Woocommerce
  • Eric5: The OK button of 'new project' dialog is disable
  • SELECT on JSONField with Django
  • Making Django.contrib.auth store plain-text password
  • Threads and Concurrent Modification Exception working with a list
  • can you use embedded ruby in custom javascript files in rails?
  • Authorize Attribute Authentication with Postman in Web Api
  • Multiple canvases (pages) in Fabric.js
  • Pandas time series data Index from a string to float [duplicate]
  • Find all parks for a given zipcode with google maps
  • How to display converted time zones in a 'generic week' (Sunday thru Saturday)?
  • AWS RDS Parameter Group not changing MySQL encoding
  • content must have a ListView whose id attribute is 'android.R.id.list'
  • Java Collections.shuffle() weird behaviour [closed]
  • how to specify different css for ie
  • How can i move Clearcase dyamic/snapshot views to another host (Linux)
  • Typeahead.js does give me suggestions but doesn't select them
  • Drag and drop unicode TText in DelphiXe4
  • How to use Streams api peek() function and make it work?
  • SpringBoot: Bypass OncePerRequestFilter filters
  • Android: Unable to detect vertical plane
  • Bind selectedDates Aggregation for Calendar
  • No OpKernel was registered to support Op 'Conv2D' with these attrs