on 06-25-2015 11:52 AM
Hi
I have a project with a couple of views in it.
I would like each and every view of it
to act as a reusable view.
My question:
1) Is it possible to put this project on the server
and just refer to it from other projects
whenever they require its functionality?
2) Must this reusable view be a part
of each and every new project
that requires it?
3) I read about component containers
but I am not sure where exactly to put them
regards
Yuval
1. It's possible to put that project and access through the url . and add those url in your index.html using <script>.
2. May be navigation from Application to application concept you can use.
3. In my organization, we create the util BSP application and put all the reusable things here. in same package we are deployed ui5 as bsp application.
And i'm sure it will access from outside package also.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
IMO, the cleanest way indeed is to define the local resource roots in your script tag.
Lets say you have application 'app1' running from <host>/app1, and you want to embed a view from a second application 'reusable' running from <host>/reusable.
Both applications have their views defined in sub folder ./views
You then specify your bootstrap script as follows:
<script src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.m"
data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-resourceroots='{"app1": "./", "reusable": "/reusable/views" } '>
You now call your view 'myreusableview' inside 'reusable' from 'app1' as follows:
var reusableView = sap.ui.view({id:"idSomeExternalView", viewName:"reusable.myreusableview", type:sap.ui.core.mvc.ViewType.XML});
p.1 to add, there is an API method which does the same
jQuery.sap.registerResourcePath(sResourceNamePrefix, vUrlPrefix)
so when you do jQuery.sap.require (for fragments or views) it uses it as
mUrlPrefixes[sResourceNamePrefix] = vUrlPrefix;
p.2 declare a reusable fragment and use it in every view you need
p.3 component container is to use component (suprise!), component can have bunch of views, it's on nav container(s) and so on.
This sap document may help you,
Registering Component Resources - User Interface Add-On for SAP NetWeaver - SAP Library
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
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.