EasyUI Forum
October 31, 2025, 06:23:57 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: Setting value for datagrid bug  (Read 11542 times)
JohnWang
Newbie
*
Posts: 5


View Profile
« on: December 05, 2014, 08:43:27 PM »

Dear admins:
When I upgraded jQueryEasyUI 1.3.6 to 1.4.1, I found something wrong in my project.
Code:
{field:'xxxId', title:'YYY', hidden:'true', align:'center', width:50, editor:'text'},
{field:'aaaaName', title:'XXX', align:'center', width:250, sortable:true,
editor:{
type:'combobox',
options:{
valueField:'aaaaName',
panelWidth: 250,
idField: 'id',
textField: 'bbbbName',
url: 'xxx.do?method=getXXX',
striped:true,
editable: false,
onSelect: onSelectAAAName,
required:true
}
}
},


function onSelectAAAName(rec){

var ed = $('#dataForm').datagrid('getEditor', {index:editIndex, field:'xxxId'});
$(ed.target).val(rec.id); //for 1.3.6   it doesn't work in 1.4.1
//$(ed.target).numberbox('setValue', rec.id); //for 1.4.1  I shound use this line instead
}


And then  when I saved my data,  I found "row.xxxId" is null in 1.4.1.  So I changed my code to use "$(ed.target).numberbox('setValue', rec.id)",
and it worked.
Logged
gongjw123
Newbie
*
Posts: 7


View Profile
« Reply #1 on: January 29, 2015, 11:23:38 PM »

I met the same problem.My solution is get the editor object in the ondbclickrow event of the datagrid and then bind the event function .

your example

var ed = $('#dataForm').datagrid('getEditor', {index:editIndex, field:'xxxId'});

the "ed" is null
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!