EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Opan Mustopah on January 13, 2015, 09:53:36 PM



Title: onBeginedit in treegrid cannot clear value editor
Post by: Opan Mustopah on January 13, 2015, 09:53:36 PM
afternoon all,

i have a problem with clearing element value, in this case is combogrid.
here is my code :
Code:
onBeginEdit:function(index,row){
        if (state.row == 'new_row'){
          var id_modul = $(this).treegrid('getEditor',{id:row.id_tree, field:'id_modul'});
          $(id_modul.target).combogrid('clear');
          console.log('opan');
        }
      },

as you can see, i already defined clear method for combogrid but the text still appear, or how to make combo element when his value is empty or null, the text element will empty too. because in my project some combo element won't clear his text when value is empty.

how to solve this issue?

many thanks for the answer.


Title: Re: onBeginedit in treegrid cannot clear value editor
Post by: stworthy on January 14, 2015, 08:12:40 AM
Please refer to this example http://jsfiddle.net/tn8qn2n5/. Before using that please download the patch from http://www.jeasyui.com/download/downloads/jquery-easyui-1.4.1-patch.zip


Title: Re: onBeginedit in treegrid cannot clear value editor
Post by: Opan Mustopah on January 14, 2015, 08:38:35 AM
thanks stworthy for your replay,

about the patch is it oke when i'm using version 1.4?


Title: Re: onBeginedit in treegrid cannot clear value editor
Post by: Opan Mustopah on January 14, 2015, 07:31:04 PM
this still not working,
and thrown me a new error.
see bug combogrid1.png

and i already include the patch

see already include.png

and this onbeforeedit to clear combo element is not working too in datagrid.

here my code:

Code:
onBeginEdit:function(index,row){
        var port_host_id = $(this).datagrid('getEditor',{index:index,field:'port_host_id'});
        if (state.row == "new_row"){
          $(port_host_id.target).combogrid('clear');
          console.log(port_host_id.target);
        }
      },



Title: Re: onBeginedit in treegrid cannot clear value editor
Post by: stworthy on January 15, 2015, 12:38:02 AM
If you are using easyui 1.4, please download the corresponding patch from http://www.jeasyui.com/download/downloads/jquery-easyui-1.4-patch.zip.
Code:
onBeginEdit:function(row){
  var id_modul = $(this).treegrid('getEditor',{id:row.id_tree, field:'id_modul'});
  //...
}


Title: Re: onBeginedit in treegrid cannot clear value editor
Post by: Opan Mustopah on January 15, 2015, 01:58:33 AM
thanks stworthy for the patch, but after i include that file into my project, i got error row is undefined, in fact onBeginEdit has parameter row and index,

see bug clear combogrid.png

as you can see, i try to debug what is content of row object. and i got undefined.



Title: Re: onBeginedit in treegrid cannot clear value editor
Post by: Opan Mustopah on January 15, 2015, 03:59:35 AM
i'm sorry stworthy about the error row is undefined. its my mistake.
but back to the problem , i still can not clear combo element.
i'm sure i already inlclude your patch file.


Title: Re: onBeginedit in treegrid cannot clear value editor
Post by: stworthy on January 15, 2015, 07:24:56 AM
Please refer to this example http://jsfiddle.net/tn8qn2n5/. Select the 'Coding' row and click the 'Edit' button, the combogrid editor will clear its value.


Title: Re: onBeginedit in treegrid cannot clear value editor
Post by: Opan Mustopah on January 15, 2015, 09:11:13 AM
did you already try your example in firefox? because when i try your example in chrome its work fine, but when i run in firefox, combogrid won't clear it's value.

i almost depression with this.


Title: Re: onBeginedit in treegrid cannot clear value editor
Post by: stworthy on January 15, 2015, 07:58:25 PM
Yes, it works fine in firefox browser. Please try to refresh your page and then run this example again.


Title: Re: onBeginedit in treegrid cannot clear value editor
Post by: Opan Mustopah on January 16, 2015, 01:04:07 AM
okay stworthy.
many thanks for your help.