hello again.
i have a problem with updateRow method.
i have a datagrid using editing method in row, and i some field using combogrid and have an event when i select one of the options, it will update the current row.
but when i call updateRow method, the datagrid will ending editing mode.
here is my code:
onBeginEdit: function(index,row){
var ccy_ori = $(this).datagrid('getEditor',{index: index,field: 'ccy_ori'});
var row_grid = row;
var idx = index;
setValueGridEditorNew(ccy_ori, 'grid');
$(ccy_ori.target).combogrid('attachEvent',{
event: 'onSelect',
handler: function(index,row){
row_grid.ccy_ori_name = row.currency_name;
row_grid.ccy_ori = row.currency_id;
var invoice_date = $('#invoice_date').datebox('getValue');
$.get("#{sc_get_currency_rate_m_invoice_as_path(:prm => params[:prm])}",
{
prm_currency_id: row_grid.currency_id,
prm_currency_id_grid: row.currency_id,
prm_invoice_date: invoice_date
},
function(data){
if (data != null){
row_grid.ccy_rate = data.currency_rate;
row_grid.ccy_rate_div = data.currency_rate_div;
sf_calculate_ccy_amount(row_grid, idx);
}else{
$.messager.alert('Info','No Currency Rate found for currency '+row_grid.currency_name+' to '+row.currency_name);
return false;
}
},'json');
}
});
/*
$(ccy_ori.target).combogrid({
onSelect: function(index, row){
row_grid.ccy_ori_name = row.currency_name;
row_grid.ccy_ori = row.currency_id;
var invoice_date = $('#invoice_date').datebox('getValue');
$.get("#{sc_get_currency_rate_m_invoice_as_path(:prm => params[:prm])}",
{
prm_currency_id: row_grid.currency_id,
prm_currency_id_grid: row.currency_id,
prm_invoice_date: invoice_date
},
function(data){
if (data != null){
row_grid.ccy_rate = data.currency_rate;
row_grid.ccy_rate_div = data.currency_rate_div;
sf_calculate_ccy_amount(row_grid, idx);
}else{
$.messager.alert('Info','No Currency Rate found for currency '+row_grid.currency_name+' to '+row.currency_name);
return false;
}
},'json');
}
});
*/
},
--------------------------------------------------------
function sf_calculate_ccy_amount(row_data, idx){
if (row_data.ccy_rate > 0){
row_data.ccy_amount = parseFloat(row_data.oc_amount_other) * parseFloat(row_data.ccy_rate);
$service_data.datagrid('updateRow',{
index: idx,
row: {
ccy_amount: parseFloat(row_data.oc_amount_other) * parseFloat(row_data.ccy_rate),
ccy_rate: row_data.currency_rate,
ccy_rate_div: row_data.currency_rate_div
}
});
}else if (row_data.ccy_rate_div > 0){
row_data.ccy_amount = parseFloat(row_data.oc_amount_other) / parseFloat(row_data.ccy_rate_div);
$service_data.datagrid('updateRow',{
index: idx,
row: {
ccy_amount: parseFloat(row_data.oc_amount_other) / parseFloat(row_data.ccy_rate_div),
ccy_rate: row_data.currency_rate,
ccy_rate_div: row_data.currency_rate_div
}
});
}else{
row_data.ccy_amount = parseFloat(row_data.oc_amount_other);
}
loadLinkbutton('#service_data');
}
it is possible to update an row while that row is on editing mode?
many thanks for the answer