EasyUI Forum
November 03, 2025, 08:30:59 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: hide columns when editing row.[solved]  (Read 10112 times)
Opan Mustopah
Full Member
***
Posts: 164


Indonesia


View Profile Email
« on: January 17, 2015, 01:18:05 AM »

hello again,

just to the point.
i want to some column/editor when editing a row with some condition.
here is how defined it:
Code:

onBeginEdit:function(index,row){
        // start list editor yang memiliki rules
        var transport_mode = $(this).datagrid('getEditor',{index:index,field:'transport_mode_id'});
        var port_ori = $(this).datagrid('getEditor',{index:index,field:'port_id_ori'});
        var port_dest = $(this).datagrid('getEditor',{index:index,field:'port_id_dest'});
        var zone_ori = $(this).datagrid('getEditor',{index:index,field:'zone_id_ori'});
        var zone_dest = $(this).datagrid('getEditor',{index:index,field:'zone_id_dest'});
        var nw = $(this).datagrid('getEditor',{index:index,field:'nw'});
        var gw = $(this).datagrid('getEditor',{index:index,field:'gw'});
        // stop list editor yang memiliki rules

        // start dapatkan options column
        var port_ori_opt = $(this).datagrid('getColumnOption','port_id_ori'); // in this i test to hide port_id_ori column when begin editing.
        port_ori_opt.hidden = true;
        console.log(port_ori_opt);

        // stop dapatkan options column
        $(port_ori.target).combogrid({
          onChange:function(newValue,oldValue){
            var port_dest_val = $(port_dest.target).combogrid('getValue');
            var port_ori_val = $(this).combogrid('getValue');
            if (port_ori_val != "" && port_dest_val != ""){
              if (newValue == port_dest_value){
                $.messager.alert('Info','Port Ori and Port Dest cannot be same.','info');
                $(this).combogrid('setValue','');
                $(this).focus();
              }
            }
          }
        });

        $(port_dest.target).combogrid({
          onChange:function(newValue,oldValue){
            var port_dest_val = $(this).combogrid('getValue');
            var port_ori_val = $(port_ori.target).combogrid('getValue');
            if (port_dest_val != "" && port_ori_val != ""){
              if (newValue == port_ori_val){
                $.messager.alert('Info','Port Ori and Port Dest cannot be same.','info');
                $(this).combogrid('setValue','');
                $(this).focus();
              }
            }
          }
        });

        $(nw.target).numberbox({
          onChange:function(newValue,oldValue){
            var nw_val = $(this).numberbox('getValue');
            var gw_val = $(this).numberbox('getValue');
            if (nw_val != "" && gw_val != ""){
              if (!isNaN(gw_val) && !isNaN(nw_val)){
                if (parseFloat(nw_val) > parseFloat(gw_val)){
                  $.message.alert('Info',"NW must be lower than GW",'info');
                  $(this).focus();
                  $(this).numberbox('setValue','0');
                }
              }
            }
          }
        });
}


but it's not working, port_id_ori not hidden at all.
whats wrong with my code?

many thanks for the answer
« Last Edit: January 17, 2015, 08:33:43 AM by Opan Mustopah » 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: January 17, 2015, 08:07:16 AM »

To hide a column, please call 'hideColumn' method instead.
Code:
var field = ...;
$('#dg').datagrid('hideColumn', field);
Logged
Opan Mustopah
Full Member
***
Posts: 164


Indonesia


View Profile Email
« Reply #2 on: January 17, 2015, 08:33:29 AM »

oh god, i really not see that method, thank you very much stworthy.
Logged

-- Bajak Otak --
*** Sorry for my bad english :3 ***
--JeasyUI version 1.4--
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!