on 2018 Dec 24 10:19 AM
Hi,
I'm creating custom F4 help screens same as Smart Field with Value Help.
UI screen flow is from view1.view.xml->fragment1->fragment2.
For both fragment1 & fragment2, im calling from view1.controller.js and i had used addDependent().
However i'm struck while accessing fragment2 UI element values in view1.controller.js and couldnt add a panel to fragement2 dyanamically.
Any advice is deeply appreciated.
PS: Please find attached screenshot for reference.
Regards,
Natarajan
Usually, the problem is no about the addDependent. That method allows you to add the control (in this case the fragment/dialog) to the current view lifecycle. It means that the control will react to the same event of the view. So when you destroy the view, the fragment/dialog will be automatically destroyed.
I think that the issue is when you create the fragment. Here's a snippet of code that will help you:
onSalesOrderItemDialogOpen: function(bFromCreate, oItemBindingContextPath) {
this._fromCreate = bFromCreate;
this.getView().getModel("data").setProperty("/salesOrderItemFormCreate", bFromCreate);
if (!this._oEditDialog) {
this._oEditDialog = sap.ui.xmlfragment(this.getView().getId(), "com.techedge.training.SAPUI5Training.view.fragment.dialog.SaleOrderItemEditDialog", this);
this.getView().addDependent(this._oEditDialog);
}
this._oEditDialog.bindElement( oItemBindingContextPath );
// toggle compact style
jQuery.sap.syncStyleClass("sapUiSizeCompact", this.getView(), this._oEditDialog);
this._oEditDialog.open();
},
As you can see when I create the sap.ui.xmlfragment I'm passing to it three parametes. The first one is the one that you need to specify. It is the view ID. This is is foundamental when in your controller you want to retrieve a fragment element with an ID. If you don't specify the view ID the this.getView().byId() will not work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
https://ui5.sap.com/#/topic/5da591c5a5a54740948acfe56b22fbc3
study that chapter to understand what you are missing......
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
69 | |
13 | |
10 | |
10 | |
9 | |
9 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.