EasyUI Forum
May 03, 2024, 08:39:30 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Edit rows in a datagrid full on the server side  (Read 23731 times)
bvicencio
Newbie
*
Posts: 13


View Profile Email
« on: July 03, 2012, 08:17:45 AM »

I need to know how to record changes in a datagrid on the server. I have a datagrid with 40 rows of data, which I can edit them, but to save the changes of all ranks edited with a single button, not for each row as shown in the tutorial.

I will be very grateful for your help.
« Last Edit: July 09, 2012, 06:56:23 AM by bvicencio » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: July 09, 2012, 04:14:13 PM »

Call getChanges method to get all inserted, updated, deleted, appended records. The next step is to post them to server.
Logged
bvicencio
Newbie
*
Posts: 13


View Profile Email
« Reply #2 on: July 13, 2012, 11:00:50 AM »

Thank you Stworthy. But, Could you give me an example?.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 on: July 14, 2012, 08:17:47 PM »

The code below shows how to get inserted records and save them.

var inserted = $('#dg').datagrid('getChanges','inserted');
// Now post them to server:
for(var i=0; i<inserted.length; i++){
  var record = inserted;
  $.ajax({
    url:'...',
    data:record,
    //...
  });
}
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!