EasyUI Forum
September 14, 2025, 11:12:01 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: Datagrid editing  (Read 7153 times)
erkin
Newbie
*
Posts: 29


View Profile
« on: July 12, 2017, 12:32:58 AM »

Hello!
I have in a datagrid the one complex field as key-value object. To edit this field, I made an custom editor in modal dialog.
How to make so that after editing this datagrid row was marked as updated and was in the result returned by datagrid('getChanges', 'updated')?
Logged
Pierre
Sr. Member
****
Posts: 439


View Profile Email
« Reply #1 on: July 12, 2017, 01:20:50 AM »

To update row:
You need to have defined "idField" in your datagrid (check doc's how to do that).
Then you have something like this:
Code:
  var yourID = $('#dg').datagrid('getSelected').id;          // get selected ID
  var index = $('#dg').datagrid('getRowIndex',yourID);       // get index
  $('#dg').datagrid('updateRow',{
    index: index,
    row: {
      yourfield1: 'some field from your dialog (editor)',
      yourfield2: 'some other value'
    }
  });

to get changes, here is example: http://www.jeasyui.com/easyui/demo/datagrid/rowediting.html
Logged
erkin
Newbie
*
Posts: 29


View Profile
« Reply #2 on: July 12, 2017, 04:14:17 AM »

Thank for answer and example code, it work!
I incorrectly called UpdateRow and getChanges did not return anything.
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!