寻找缺少的对话框值^^

2020-09-20 05:50发布

点击此处---> 群内免费提供SAP练习系统(在群公告中)加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中) Helloooo专家 ...

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


Helloooo专家

我有一个对话框,可用于创建和更新条目。 除了一点点(但仍然很烦人),一切都正常。

当我为现有条目调用对话框时,一切都很顺利。 字段正常显示,更新正常。

当我调用对话框创建一个新条目时,我得到了一组空白字段,我将其全部填满,按保存并确定即可。 问题出在哪里? 这些字段之一应该已经有一个值,因为我已经使用 oModel.createEntry 方法分配了一个值。 我调试了应用程序,该条目的属性看起来还不错,一切似乎都很好(如果不是盲目的),但是该值不随字段提供-会响起什么钟声?

下面附上的代码(非常简短),有疑问的字段: iAgrId 。

谢谢!

格雷格

 onActionAdd:function(){

 var oModel = this.getView()。getModel();

//oModel.createEntry("/img/Agreement_ActionsSet");
 var oActionEditDialog = new Dialog({title:"创建操作"});


 this.createActionFormData(oActionEditDialog,oModel);

//获取协议ID
 var sAgreement = this.getView()。getBindingContext()。toString()。slice(16,26);
 var oNewObject =" {\" AgrId \":\"" + sAgreement +" \"}";
 oNewObject = JSON.parse(oNewObject);
 this.getView()。addDependent(oActionEditDialog);
 var oEntry = oModel.createEntry("/img/Agreement_ActionsSet",oNewObject);
 oActionEditDialog.setBindingContext(oEntry);
//oActionEditDialog.bindElement(oEntry);

 oActionEditDialog.open();
 },


 onActionEdit:function(oSourceEvent){


 var oModel = this.getView()。getModel();

 var oActionEditDialog = new Dialog({title:" Edit Action Details"});


 this.createActionFormData(oActionEditDialog,oModel);

//访问全局模型
 var sPath = oSourceEvent.getSource()。getParent()。getBindingContext()。toString();
 this.getView()。addDependent(oActionEditDialog);
 oActionEditDialog.bindElement(sPath);

 oActionEditDialog.open();
 },


//填充表单字段
 createActionFormData:function(oActionEditDialog,oModel){


 var oActionTypeItemTemplate = new sap.ui.core.ListItem({键:" {f4> AgrActtypeid}",文本:" {f4> AgrActtypeid}",additionalText:" {f4> AgrActtypetxt}"});
 var oActionStatusItemTemplate = new sap.ui.core.ListItem({键:" {f4> AgrStatid}",文本:" {f4> AgrStatid}",additionalText:" {f4> AgrStattxt}"}));
 var oActionAgentItemTemplate = new sap.ui.core.ListItem({键:" {f4> AgrAgentid}",文本:" {f4> AgrAgentid}",additionalText:" {f4> AgrAgenttxt}"}));


 var sAgrId = new sap.m.Label({text:" {i18n> actionAgrId}"});
 var iAgrId = new sap.m.Input({value:" {AgrId}"});
 var sAgrActionid = new sap.m.Label({text:" {i18n> actionLineItemTableIDID}}});
 var iAgrActionid = new sap.m.Input({value:" {AgrActionid}",enabled:false});
 var sCreatedBy = new sap.m.Label({text:" {i18n> actionCreatedBy}"});
 var iCreatedBy = new sap.m.Input({value:" {CreatedBy}"});
 var sCreatedOn = new sap.m.Label({text:" {i18n> actionCreatedOn}"});;
 var iCreatedOn = new sap.m.DatePicker({value:" {path:'CreatedOn',type:'sap.ui.model.type.Date',formatOptions:{style:'medium',strictParsing:true}}"  });
 var sActionComment = new sap.m.Label({text:" {i18n> actionComment}"}));
 var iActionComment = new sap.m.Input({value:" {ActionComment}"}));
 var sAgrActionDate = new sap.m.Label({text:" {i18n> actionActionDate}"});;
 var iAgrActionDate = new sap.m.DatePicker({value:" {path:'AgrActionDate',type:'sap.ui.model.type.Date',formatOptions:{style:'medium',strictParsing:true}}"  });
 var sAgrChaseDate = new sap.m.Label({text:" {i18n> actionChaseDate}"}));
 var iAgrChaseDate = new sap.m.DatePicker({value:" {path:'AgrChaseDate',type:'sap.ui.model.type.Date',formatOptions:{style:'medium',strictParsing:true}}"  });
 var sAgrActtypeid = new sap.m.Label({text:" {i18n> actionActionType}"});;
 var iAgrActtypeid = new sap.m.ComboBox({
//id:" cbRoleType",
 selectedKey:" {AgrActtypeid}",
//selectedItemId:" {AgrRoletptxt}",
 showSecondaryValues:true,
 项目:{
 路径:" f4>/Action_TypesSet",
 模板:oActionTypeItemTemplate,
 templateShareable:"假"}
 })。bindProperty(" value"," AgrActtypeid");
 var sAgrStatidFrom = new sap.m.Label({text:" {i18n> actionStatusFrom}"});;
 var iAgrStatidFrom = new sap.m.ComboBox({
//id:" cbRoleType",
 selectedKey:" {AgrStatidFrom}",
//selectedItemId:" {AgrRoletptxt}",
 showSecondaryValues:true,
 项目:{
 路径:" f4>/Agreement_StatusesSet",
 模板:oActionStatusItemTemplate,
 templateShareable:"假"}
 })。bindProperty(" value"," AgrStatidFrom"));
 var sAgrStatidTo = new sap.m.Label({text:" {i18n> actionStatusTo}"});;
 var iAgrStatidTo = new sap.m.ComboBox({
//id:" cbRoleType",
 selectedKey:" {AgrStatidTo}",
//selectedItemId:" {AgrRoletptxt}",
 showSecondaryValues:true,
 项目:{
 路径:" f4>/Agreement_StatusesSet",
 模板:oActionStatusItemTemplate,
 templateShareable:"假"}
 })。bindProperty(" value"," AgrStatidTo");
 var sAgrAgentidFrom = new sap.m.Label({text:" {i18n> actionAgentFrom}"}));
 var iAgrAgentidFrom = new sap.m.ComboBox({
//id:" cbRoleType",
 selectedKey:" {AgrAgentidFrom}",
//selectedItemId:" {AgrRoletptxt}",
 showSecondaryValues:true,
 项目:{
 路径:" f4>/Agreement_AgentsSet",
 模板:oActionAgentItemTemplate,
 templateShareable:"假"}
 })。bindProperty(" value"," AgrAgentidFrom");
 var sAgrAgentidTo = new sap.m.Label({text:" {i18n> actionAgentTo}"});;
 var iAgrAgentidTo = new sap.m.ComboBox({
//id:" cbRoleType",
 selectedKey:" {AgrAgentidTo}",
//selectedItemId:" {AgrRoletptxt}",
 showSecondaryValues:true,
 项目:{
 路径:" f4>/Agreement_AgentsSet",
 模板:oActionAgentItemTemplate,
 templateShareable:"假"}
 })。bindProperty(" value"," AgrAgentidTo");

 var oSaveButton = new sap.ui.commons.Button({
 文字:"保存",
 按下:功能(oEvent){
 oModel.submitChanges({
 成功:function(oData,sResponse){
 },
 错误:function(oError){
 jQuery.sap.log.error(" oData Failure",oError);
 }
 });
                                 oEvent.getSource()。getParent()。close();
 }
 });
 var oCancelButton = new sap.ui.commons.Button({
 文字:"取消",
 按下:功能(oEvent){
             oModel.resetChanges();
                                 oEvent.getSource()。getParent()。close();
 }
 });


 oActionEditDialog.addContent(sAgrId);
 oActionEditDialog.addContent(iAgrId);
 oActionEditDialog.addContent(sAgrActionid);
 oActionEditDialog.addContent(iAgrActionid);
 oActionEditDialog.addContent(sCreatedBy);
 oActionEditDialog.addContent(iCreatedBy);
 oActionEditDialog.addContent(sCreatedOn);
 oActionEditDialog.addContent(iCreatedOn);
 oActionEditDialog.addContent(sActionComment);
 oActionEditDialog.addContent(iActionComment);
 oActionEditDialog.addContent(sAgrActionDate);
 oActionEditDialog.addContent(iAgrActionDate);
 oActionEditDialog.addContent(sAgrChaseDate);
 oActionEditDialog.addContent(iAgrChaseDate);
 oActionEditDialog.addContent(sAgrActtypeid);
 oActionEditDialog.addContent(iAgrActtypeid);
 oActionEditDialog.addContent(sAgrStatidFrom);
 oActionEditDialog.addContent(iAgrStatidFrom);
 oActionEditDialog.addContent(sAgrStatidTo);
 oActionEditDialog.addContent(iAgrStatidTo);
 oActionEditDialog.addContent(sAgrAgentidFrom);
 oActionEditDialog.addContent(iAgrAgentidFrom);
 oActionEditDialog.addContent(sAgrAgentidTo);
 oActionEditDialog.addContent(iAgrAgentidTo);

 oActionEditDialog.addContent(oSaveButton);
 oActionEditDialog.addContent(oCancelButton);
 }
 

createentry.jpg (308.8 kB)