on 12-31-2022 11:03 AM
I need a fragment dialog for entering / editing fields belong to an entity in my project, but I also need Input / Value Helps for the fields on the fragment. So I tried to use SmartFields for it.
I'm trying to use element binding on a dialog fragment which includes Smart Fields, it's not working, can anyone tell me what's wrong in following steps :
For SmartForm and SmartFields I found this example on DemoKit : Smart Field , in this example element binding on the view is simply done by this command :
onInit: function () {
var oView = this.getView();
oView.bindElement("/Products('1239102')");
}<br>
I tried to do the same on my fragment, fragment XML code is below , I just copied SmartForm and SmartField components from the examples in DemoKit. "Title" and "MeetupType" fields are existing fields in my Mock Server's EntitySet with name "Meetups" :
<core:FragmentDefinition
xmlns="sap.m"
xmlns:core="sap.ui.core"
xmlns:form="sap.ui.comp.smartform"
xmlns:smartField="sap.ui.comp.smartfield"
>
<Dialog id="dialogMeetupEdit" title="Edit meeting :">
<content>
<form:SmartForm id="SF1" class="editableForm" editTogglable="true" editable="true" title="{Name}">
<form:Group id="G1" label="SmartField with ValueHelp">
<form:GroupElement id="GE-Title">
<smartField:SmartField id="idTitle" value="{Title}"/>
</form:GroupElement>
<form:GroupElement id="GE-MeetupType">
<smartField:SmartField id="idMeetupType" value="{MeetupType}"/>
</form:GroupElement>
</form:Group>
</form:SmartForm>
</content>
<beginButton> <Button text="Save" /> </beginButton>
<endButton> <Button text="Cancel" type="Reject" press="closeMeetupDialog"/> </endButton>
</Dialog>
</core:FragmentDefinition>
In controller, before opening the fragment , I try to make element binding as below :
onAddEntry: function(oEvent){
var lo_dialog = this.getMeetupEditDialog(this);
lo_dialog.bindElement("/Meetups('1')");
lo_dialog.open();
},
getMeetupEditDialog : function(ip_this) {
ip_this.meetupEditDialog = sap.ui.getCore().byId("dialogMeetupEdit");
if (!ip_this.meetupEditDialog)
{
ip_this.meetupEditDialog = sap.ui.xmlfragment("MyProject.fragments.meetupEdit", ip_this);
ip_this.getView().addDependent(ip_this.meetupEditDialog);
jQuery.sap.syncStyleClass("sapUiSizeCompact", ip_this.getView(), ip_this.meetupEditDialog);
}
return ip_this.meetupEditDialog;
},
My purpose is creating an entry / edit dialog for the entity fields with Input Helps set by annotations. If there is any other proper way to do this , that can also be an answer to my question.Thanks in advance
"doesn't work" means what? for now it means nothing...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
74 | |
8 | |
8 | |
7 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.