EasyUI Forum

General Category => Bug Report => Topic started by: JohnWang on December 05, 2014, 08:43:27 PM



Title: Setting value for datagrid bug
Post by: JohnWang 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.


Title: Re: Setting value for datagrid bug
Post by: gongjw123 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