EasyUI Forum
December 01, 2025, 03:59:00 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Preallocate a editor field  (Read 11730 times)
jaimi
Full Member
***
Posts: 121


View Profile
« on: September 21, 2012, 10:59:40 PM »

I want to preset a field with a value and this value should be sent to the saveUrl-script.
When I do it like this the value is set but it doesn't sent it.

{field:'OLT40A002T_KEY',title:'ProjektKey'      ,width:080,sortable:'true',
    formatter : function(value, row, index){return $('#OLT40A002T_KEY').val();}
},  

I tried this but the value won't be set:
{field:'OLT40A002T_KEY',title:'ProjektKey'      ,width:080,sortable:'true',
    editor    : {type:'text'},
    formatter : function(value, row, index){return $('#OLT40A002T_KEY').val();}
   },  

I tried this as well:

{field:'OLT40A002T_KEY',title:'ProjektKey'      ,width:080,sortable:'true',
    editor : {
     type:'numberbox',
     options: {
      //formatter : function(value){return /*$('#OLT40A002T_KEY').val()*/28;}
      value : 888
     }
    }

The default value is not set. Is this a bug?
When I activate the formatter the value is displayed but it is not sent to the saveUrl.
It is really tricky. Can anyone give me a hint?

What is the solution?
« Last Edit: September 23, 2012, 01:21:08 AM by jaimi » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: September 23, 2012, 05:44:30 PM »

When begin an editing, the editor default value will be updated with the row field value. If you are using the edatagrid plugin, you could set the default editor value in 'onEdit' event.

Code:
$('#dg').edatagrid({
onEdit:function(index,row){
var ed = $(this).edatagrid('getEditor',{
index:index,
field:'OLT40A002T_KEY'
});
$(ed.target).val($('#OLT40A002T_KEY').val());
}
});
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!