这是通过 数组形式显示
function showDefaultImg_org_edit() {
debugger;
var imageUrls = [ "identiImgUrl_org_edit", "identibackImgUrl_org_edit",
"identiImgUrl2_org_edit", "cardImgUrl_org_edit", "cardImgUrl2_org_edit",
"licenseImgUrl_org_edit", "taxLicenseImgUrl_org_edit", "orgLicenseUrl_org_edit",
"openProveImgUrl_org_edit", ];
var len = imageUrls.length;
for (var i = 0; i < len; i++) {
var imageurl = imageUrls[i];
var imgFile = imageurl + "File";
var imgpath = addForm_org_edit.getForm().findField(imageurl).getValue();
if (imgpath == "" || imgpath == null) {
imgpath = default_img;
}
Ext.getCmp(imgpath).setSrc(imageurl);
addForm_org_edit.getForm().findField(imgFile).allowBlank = true;
}
}
这是单独进行显示
Ext.getCmp("identiImgUrl_org_edit").setSrc(record2.data.identiImgUrl);
Ext.getCmp("identibackImgUrl_org_edit").setSrc(record2.data.identibackImgUrl);
Ext.getCmp("identiImgUrl2_org_edit").setSrc(record2.data.identiImgUrl2);
Ext.getCmp("cardImgUrl_org_edit").setSrc(record2.data.cardImgUrl);
Ext.getCmp("cardImgUrl2_org_edit").setSrc(record2.data.cardImgUrl2);
Ext.getCmp("licenseImgUrl_org_edit").setSrc(record2.data.licenseImgUrl);
Ext.getCmp("taxLicenseImgUrl_org_edit").setSrc(record2.data.taxLicenseImgUrl);
Ext.getCmp("orgLicenseUrl_org_edit").setSrc(record2.data.orgLicenseUrl);
Ext.getCmp("openProveImgUrl_org_edit").setSrc(record2.data.openProveImgUrl);
单独进行显示是正常的,
但是 以数组的形式进行显示时,会报错,报错如下。
检查了数据库,图片已经保存。
Uncaught TypeError: Cannot call method 'getValue' of null