EasyUI Forum
November 02, 2025, 04:35:49 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: updateRow method end the editing event  (Read 9036 times)
Opan Mustopah
Full Member
***
Posts: 164


Indonesia


View Profile Email
« on: April 08, 2015, 08:59:51 PM »

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:

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

Logged

-- Bajak Otak --
*** Sorry for my bad english :3 ***
--JeasyUI version 1.4--
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: April 09, 2015, 12:21:04 AM »

Call 'updateRow' method to update a row will end the editing mode. The alternative way to solve your issue is to use a 'label' editor, please refer to the following topics.

http://www.jeasyui.com/forum/index.php?topic=2063.0
http://www.jeasyui.com/forum/index.php?topic=1803.0
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!