表的样式:
$.ajax({
type:'post',
url:"../repairType/getRepairType.do",
success:function(ret){
if (ret.code == 200) {
$('#reType').combobox({
data: ret.data,
height: 33,
editable:false,
panelHeight:'auto',
valueField:'id',
textField:'type',
onLoadSuccess : function() {
var data = $('#repairType').combobox('getData');
if(data.length > 0){
//方式一:写死
//$("#reType").combobox("select", "加班");
//$("#reType").combobox("setValue", 2);
//方式二:动态查
var typeValue = "";
var typeText = "";
var flag = false;
for(var i=0; i<data.length; i++){
for(var item in data[i]){
if(item == "repairTypeId"){
typeValue = data[i][item];
}
if(item == "repairType"){
typeText = data[i][item];
}
if(typeText.indexOf("加班") >=0){
flag = true;
$("#reType").combobox("select", typeText);
$("#reType").combobox("setValue", typeValue);
}
}
if(flag){
return
}
}
}
}
});
}
}
})