var synj = "<%=arrbj[3]%>";
var xnxq = "<%=xnxq%>";
OnchangeSelect($("#nj"), "LogicLayer.Sys.OptionInfo", "EasyUIDownListEvent", "xnxqrxnj," + xnxq + ",,",true)
$("#nj").combobox('setValue',synj)
synj数据弹一下然后就从combobox里消失了,将上2行代码改为以下的一行,原因:OnchangeSelect函数用到了ajax 而ajax是异步操作 我的顺序执行快过异步操作所以绑不上弹一下
OnchangeSelect($("#nj"), "LogicLayer.Sys.OptionInfo", "EasyUIDownListEvent", "xnxqrxnj," + xnxq + ",,",false, synj)
function OnchangeSelect(selobj, cs, m, p, bL, pS) {
var myloader = function (param, success, error) {
$.ajax({
url: "../_pub/Pub_EasyUIList.aspx?cs=" + cs + "&m=" + m + "&p=" + p,
dataType: "json",
success: function (data) {
if (bL) {
data.unshift({ "value": "", "text": "" });
}
success(data);
},
error: function () {
error.apply(this, arguments);
}
});
};
$(selobj).combobox({
loader: myloader,
valueField: "value",
textField: "text",
onLoadSuccess: function () {
var data = $(selobj).combobox('getData');
if (data!=null){
if (pS != null) {
$(selobj).combobox('select', pS);
} else {
$(selobj).combobox('select', data[0].value);
}
}
}
});
}