on 2019 Sep 06 4:32 AM
Hi Everyone,
I am working on Custom SAPUI5 Development. In our usual case, we do use fragment for Dialog/Select Dialog/Valuhelp functionalities. I have few questions regarding the re usability of fragment?
1. In case if i have Edit and Create scenario, can we use same fragment.xml file? if all the fields are same for both create and edit? When i try to implement this, i usually get duplicate id issue, fragment not instantiated etc.? Is it necessary that i need to create two separate fragment for edit/create as like SAPUi5 Form examples.
Please share your views on this .
Thank you,
Regards,
JK.
sap.ui.xmlfragment([sId], sFragmentName,[oController]);
or Fragment.load
the id parameter should save you.
Fragment.load({
id: oView.getId(),
name:"sap.ui.demo.walkthrough.view.HelloDialog"}).then(function(oDialog){// connect dialog to the root view of this component (models, lifecycle)
oView.addDependent(oDialog);
oDialog.open();});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jayakrishna,
If you want to use the fragment within only one page. Then you can mention it in same view under dependents tag ( Inside page ) and you can open it in controller ( It wont through duplicate id error ).
<dependents>
<Popover >
<List>
<StandardListItem>
</StandardListItem>
</List>
</Popover>
</dependents>
If you want to use in different screens. Better to go with the two way binding ( Mention model name and property for all the elements ) and get the values in controller.
And the last point , Destroythe dialog box / popover in onclose event.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
63 | |
9 | |
8 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.