- 解决方法:
- editor不要url加载
- data:数据
- ajax请求拿到数据(同步请求不要异步请求)
editor:{
type:'combobox',
options:{
//url:APP+'/Broadband/suitComboInfo', //传统的写法
valueField:'s_id',
textField:'s_name',
data:synchroAjaxByUrl()//更改之后的写法
},
required:true
},
function synchroAjaxByUrl(url){
var temp;
$.ajax({
url:url,
type:"get",
async:false, //同步请求
dataType:"json",
success:function(data){
temp = data;
}
});
return temp;
}
如果上边写法不能解决参考下边 formatter
放在editor上边:
<th data-options="field:'userId',width:100,
formatter:function (value, row) { //放在editor上边
return row.userName;
},
editor:{
type:'combobox',
options:{
textField:'userId',
valueField:'userName',
url:'xx',
editable:false
}
}">会员等级</th>
formatter方法:
$('#cc').combobox({
formatter: function(row){
var opts = $(this).combobox('options');
return row[opts.textField];
}
});