EasyUI Forum
September 16, 2025, 11:01:51 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: predefine a value in a datagrid field on edit  (Read 7231 times)
jaimi
Full Member
***
Posts: 121


View Profile
« 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
Logged
jarry
Administrator
Hero Member
*****
Posts: 2298


View Profile Email
« Reply #1 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);
}
Logged
jaimi
Full Member
***
Posts: 121


View Profile
« Reply #2 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?
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!