EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: jaimi on October 12, 2016, 01:27:35 AM



Title: predefine a value in a datagrid field on edit
Post by: jaimi on October 12, 2016, 01:27:35 AM
How can I set a defined value to a numberbox and a combobox when the row switches to edit-mode?
I tried this but doesn't work:
Code:
 ,{field :'CUR_CDE',title:'Währung',width:090,sortable:'true',align:'left'
  ,editor  : {
        type   :'combobox'
   ,options:{
      valueField:'CUR_CDE'
     ,textField:'CUR_DES'
,url:'pferd.lkp.cur.json'
[b],value:'EUR'[/b]
,required:true
,editable:true
,prompt:'Währung...'
,missingMessage: 'Wählen Sie die Währung aus.'
       }//Options
      }//editor
    }//field

Code:
   ,{field:'HTH_GESAMT',title:'Gesamt',width:070,sortable:'true',align:'left'
      ,editor:{ type:'numberbox'
              ,options:{ required:true
            ,prompt:'Gesamt-Preis...'
            ,missingMessage:'Geben Sie den Gesamt-Preis für die Behandlung ein.'
,precision:2
,decimalSeparator:'.'
[b],min:0[/b]
,max:10000
[b],value:0.00[/b]
   }
  }//editor
    }//field


Title: Re: predefine a value in a datagrid field on edit
Post by: jarry on October 13, 2016, 01:16:00 AM
You have to change this value when beginning to edit a row.
Code:
onBeginEdit: function(index,row){
  var ed = $(this).datagrid('getEditor',{index:index,field:'listprice'});
  $(ed.target).numberbox('setValue', 100);
}


Title: Re: predefine a value in a datagrid field on edit
Post by: jaimi on October 13, 2016, 10:28:55 PM
It works in general. But I can not longer put the decimal point where in the field-options set.
How to define the options for this element?