var Sign = { ">": ">", ">=": ">=", "<": "<", "<=": "<=", "=": "=", "!=": "!=" }; JS对象
{ header: "哈哈哈", field: "KEYWORD", displayField: 'KEYWORD', width: 200, editor: { type: "combobox", data: adjustComboData(Sign)} },
{ header: "嘻嘻嘻", field: "KEYWORD", displayField: 'KEYWORD', width: 200, editor: { type: "combobox", data: adjustComboData(AimState["DT"])} },
AimState["DT"])为后台查询到的List或者表。
//转换成数组
function adjustComboData(jdata) {
var comdata = [];
if ($.isArray(jdata)) {
$.each(jdata, function () {
this.id = this.ID;
this.text = this.TEXT;
comdata.push(this);
});
} else {
$.each(jdata, function () {
var jobj = {};
jobj.id = this;
jobj.text = jdata[this];
comdata.push(jobj);
});
}
return comdata;
}