Skip to Content
0

Using HTML in Fragments

Mar 02, 2017 at 09:57 PM

32

avatar image

Hi,

I have a requirement where i need to display some text in HTML format, to be more clear it should be an ordered list, design of my app is:

User clicks on Edit mode he will get a pop up which is a Dialog once he clicks on save a XML Fragments is called, I am aware that this can be done using formatted text however we are using lower version than below.

Application Component: CA-UI5-CTR Available Since: 1.38

As formatted text is available since 1.38, i can't use this feature, any pointers will help, i have searched on SDN and did not find anything related to my requirement or may be i am not smart enough to understand.

I am not an expert in JavaScript and finding it difficult how to implement the solution.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Srikanth KV Mar 02, 2017 at 10:09 PM
0

You can use sap.ui.core.HTML element inside a fragment. Check the explored link

Share
10 |10000 characters needed characters left characters exceeded
Aarif Baig Mar 02, 2017 at 10:38 PM
0

Hi Srikanth,

This does not work with the fragments, i have already tried it.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

It still works, test this with version 1.28

Below are the steps I followed:

Step 1: Downloaded Walkthrough tutorial(step 17) from Explored app(as this contains fragment) and changed the version in index.html to 1.28

Step 2: Create a normal HTML in a notepad anywhere that you want to show, and escape HTML tags using this link

For testing I have used a sample HTML document which looks like below:


Step 3: use this escaped HTML from step 2 in Dialog fragment for UI element sap.ui.core.HTML

Output:

indexhtml.jpg (49.9 kB)
escape-html.jpg (169.2 kB)
fragment.jpg (50.5 kB)
output.jpg (19.6 kB)
1