EasyUI Forum
June 30, 2024, 11:57:35 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: edatagrid: saveRow after updateRow  (Read 2487 times)
trenboar
Newbie
*
Posts: 2


View Profile
« on: June 13, 2019, 04:24:38 AM »

Hi, I am using edatagrid. I have a table like this:
idnamecontentsstatus
. The status will be changed from code if I click a print button. My code is like this.

Code:
var row = $('#dg').edatagrid('getSelected');
var index = $('#dg').edatagrid('getRowIndex',row);
row.status = 'Yes';
$('#dg').edatagrid('updateRow',{index:index,row:row});
$('#dg').edatagrid('saveRow');
$('#dg').edatagrid('refreshRow',index);


But the data in the database doesn't change. I know how to post the changes through ajax. Is there a better way to do this automatically? Just like I clicked the row and changed the value? Thanks.
« Last Edit: June 18, 2019, 05:34:15 AM by trenboar » Logged
trenboar
Newbie
*
Posts: 2


View Profile
« Reply #1 on: June 18, 2019, 05:33:38 AM »

Hi I found the solution (maybe not the best one).

Code:
$('#dg').edatagrid('beginEdit',index);
var ed = $('#dg').datagrid('getEditor',{index:index,field:'status'});
ed.target.prop('checked','true');
$('#dg').edatagrid('endEdit',index);

« Last Edit: June 18, 2019, 05:35:15 AM by trenboar » 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!