如果只是从数据库读取并 setValue 进去,则只有 displayFiled, 而 valueField 没有,这里使用 select
load: function(records, options, success) {
var processStr = Ext.getCmp(this.rowId + "process").getValue();
var pageWorkstationKey = Ext.getCmp(this.rowId + "workstation").getValue();
if (processStr != null && processStr != "") {
if (responseObj && responseObj[this.rowId]) {
var responseWorkstationKey = responseObj[this.rowId].workstation;
var pnValue = responseObj[this.rowId].partnumber;
//这里开始
if (options) {
for (var j = 0; j < options.length; j++) {
if (options[j].data.partNumber == pnValue && (pageWorkstationKey == responseWorkstationKey)) {
Ext.getCmp(this.rowId + "partnumber").select(options[j]);
pnValue = "";
break;
} else {
Ext.getCmp(this.rowId + "partnumber").setValue("");
}
}
} else {
Ext.getCmp(this.rowId + "partnumber").setValue("");
}
//这里结束
} else {
Ext.getCmp(this.rowId + "partnumber").setValue("");
}
} else {
Ext.getCmp(this.rowId + "partnumber").setValue("");
}
var workorderStore = Ext.getCmp(this.rowId + "wo").getStore();
workorderStore.load();
}
这一句:
Ext.getCmp(this.rowId+"partnumber").select (options[j] );