EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: trenboar on June 13, 2019, 04:24:38 AM



Title: edatagrid: saveRow after updateRow
Post by: trenboar 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.


Title: Re: edatagrid: saveRow after updateRow
Post by: trenboar 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);