on 02-06-2018 1:46 PM
this is the method :New Entry Button
NewEntryPress1:function(oEvent){
this._reusableForm = new sap.ui.xmlfragment("sncr.notification.view.ReusableForm",this); this._reusableForm.placeAt('content');
}
but no content is coming on pressing new entry.
I want the another form under the form like the form displaying here ( given in fragment) .
This thing need multiple times, in every form have New Entry button.
var btn_NewEntry= new sap.m.Button("btn_newentry",{ text: "NewEntry", press: [oController.NewEntryPress1,this] });
avoid js view if possible
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Efim/Sagarika,
I implemented both things, Efim suggested code i used and worked .But On click New entry button i got fragment content which also have New entry button with 'New Entry 2' as press method .
But for button in form ( Fragment ) , even debugger is not going to Newentry2 method in controller.:
NewEntryPress1:function(oEvent){ if(!this._reusableForm) { this._reusableForm = new sap.ui.xmlfragment("sncr.notification.view.ReusableForm",this); this.getView().byId(idfragment--new_entry); } var oContainer = sap.ui.getCore().byId('MyVBoxId'); oContainer.addItem(this._reusableForm) },
NewEntryPress2:function(evt){
if(!this._reusableForm) { this._reusableForm = new sap.ui.xmlfragment("sncr.notification.view.ReusableForm",this); }
var oContainer = sap.ui.getCore().byId('MyVBoxId'); oContainer.addItem(this._reusableForm) },
view.js:
var btn_NewEntry= new sap.m.Button("btn_newentry",{ text: "NewEntry", press: oController.NewEntryPress1 });
var vbox_Container= new sap.m.VBox("MyVBoxId",{}); this._reusableForm = new sap.ui.xmlfragment("","sncr.notification.view.ReusableForm",oController);
return new sap.m.Page({ title: "SNCR Notification", content: [ label_InspectioLot,input_InspectioLot,btn_Execute,btn_NewEntry ,vbox_Container ] });
fragment:
<f:FormElement label="">
<HBox xmlns="sap.m" visible="true" height="" width="" displayInline="false" direction="Row" fitContainer="false" renderType="Div" justifyContent="Center" alignItems="" >
<items>
<Button id="new_entry" text="New Entry" tooltip="New Entry" press="NewEntryPress2" visible="true">
<layoutData> <FlexItemData growFactor="0.2" /> </layoutData>
</Button>
<Button id="" text="Save" tooltip="Save" press="onConfirmSave" visible="true">
<layoutData> <FlexItemData growFactor="4" /> </layoutData> </Button>
</items> </HBox> </f:FormElement>
repeatform-buttonpress-issue.png . on click on highlighted button , i want same form again down to this as explained in NewEntry2 method.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
If you have used a view can you check the below code once?
onInit: function() {
that = this;
this._oView = this.getView();
}
NewEntryPress1:function(oEvent){
this._reusableForm = sap.ui.xmlfragment("sncr.notification.view.ReusableForm",this);
that._oView.addDependent(_reusableForm);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi! Why do you use "placeAt" method for adding entries? It' should be used once for bootstrapping application.
You should use addAggregation method of your forms container to add new entry.
For Example, your forms will be nested inside sap.m.VBox control, so then adding new form will be:
NewEntryPress1:function(oEvent){
if(!this._reusableForm) {
this._reusableForm = new sap.ui.xmlfragment("sncr.notification.view.ReusableForm",this);
}
var oContainer = this.byId('MyVBoxId');
oContainer.addItem(this._reusableForm) //or oContainer.addAggregation('items', this._reusableForm);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.