Open Google Chrome | |
Navigate to https://account.hanatrial.ondemand.com/cockpit | |
Go to the Neo environment (can be trial) | |
Open Connectivity and select Destinations | |
Create a new Destination | |
Configure the destination to load the UI5 library template in the SAP Web IDE (You can choose your own name) | Name=UI5LabFeature URL=https://ui5librarytemplate-a6ac3f497.dispatcher.hana.ondemand.com ProxyType=Internet Type=HTTP WebIDEEnabled=true Authentication=NoAuthentication WebIDEUsage=feature Description=UI5Lab Feature |
Create a second destination for the Library Manager | Name=librarymanager URL=https://sapwebidelibrarymanager-a6ac3f497.dispatcher.hana.ondemand.com ProxyType=Internet Type=HTTP WebIDEEnabled=true Authentication=NoAuthentication WebIDEUsage=feature Description=Library Manager |
Let’s go to the SAP Web IDE | |
Go to Services | |
Search for “SAP Web IDE” and open de “Full-Stack” version | |
Open settings and select “Features” | |
Enable the feature “ui5labfeature”. This feature contains the template for the UI5 library. (You created a destination for this feature a few steps back) | |
Also enable the “Library Manager”. This one should be in the feature list by default. | |
Don’t forget to click on “Save” in the left bottom corner. | |
And refresh your browser. |
Go to “File” -> “New” -> “Project from Template” | |
Select the template “UI5Lab Library” in the category “UI5Lab” | |
Give your library a name and namespace | |
In the second step, give the name “Lightbox” for the first control and Finish the wizard | |
The generated project will look like this |
Right click on your Library and select “Build” | |
The build generates the dist folder with the library (including the preload) and two test folders. One for a local build and one that we need to use in the Web IDE | |
In the Web IDE, use the test page in the folder “test-resources-webide”. Select the folder and click on Run | |
This will show you a basic example of a UI5 control as part of the library. We can now start changing it. |
Open the “Library Browser” on the right side of the SAP Web IDE, search for “lightbox2” and select the first line. | |
Select download only excluding jquery and click on “+” | |
It will raise an error but that’s okay. | |
Images will not be downloaded due to CORS. Close the window. It could be possible that not all files are saved correctly. Just to be sure, open all created files and save them. | |
Import the images from the zip file. | |
Import the images in the folder lightbox2 | |
Just click “OK”. | |
The folder structure will look like this with the library. | |
Include the css file by adding this line in the library.source.less file in the base folder | @import (inline) "../../libs/lightbox2/css/lightbox.css"; |
Create a new file for the control | |
Call it “LightboxImage.js” | |
Start by adding the skelet for the control |
|
Add the metadata for the control with following properties |
|
Init function |
|
Setter functions |
|
Create a new file for the rendering part of the control | |
Call it “LightboxImageRenderer.js” | |
Create the renderer function |
|
Add the control to the list of controls in the library.js file |
The “Lightbox” control should already be in your project. It was generated by the Library template | |
Define Grid and lightbox. Use Grid to extend from. | |
Add the following properties in the metadata |
|
Register the id of the control in the init function |
|
Configure the lightbox with the properties of the control in the “onAfterRendering” function |
|
Delete the function setProp1 | |
Create an exit function that will call the exit function of the Grid control |
|
Go to the renderer file and change the code with this |
|
Open the “LightboxSample.html” in the sample folder | |
Change the test code to the following | |
| |
Build and run your library again | |
Click on an image and the lightbox will open |
Right click on the Library -> Deploy -> Deploy to SAP Cloud Platform | |
Try to remember the Application name (we’ll need it later) and click on Deploy | |
Done! Just close this popup. |
Create a new UI5 app based on the template SAPUI5 Application | |
Fill in a project name and namespace that you like | |
Give the first view a name | |
Open the neo-app.json and configure the path for your library |
|
Open the manifest.json and add a dependency to your library. You can use the descriptor editor or the code editor. | |
Go to the view, define the prefix for your library and add the Lightbox control between the content tags |
|
Run the app! |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
10 | |
7 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |