cancel
Showing results for 
Search instead for 
Did you mean: 

HTML Component - Binding issue

Steven_UM
Contributor
0 Kudos

Hi folks,

I am trying to bind the HTML component content attribute with data returned from an OData service.  I made sure that the OData service returns url encoded content.  This fails however whatever I return ...

I changed it even into returning a fixed value:

Lorem ipsum

Lorem ipsum dolor sit amet...

When I define my XML view like this:


<core:HTML id="dvm" content="{ValueMappingError/ContentValue}" preferDOM="false"></core:HTML>

I am getting the following exception thrown ( with our without any of the above extra attributes )

Uncaught Error: Syntax error, unrecognized expression: &lt;div class=&quot;content&quot;&gt;&lt;h4&gt;Lorem ipsum&lt;/h4&gt;&lt;div&gt;Lorem ipsum dolor sit amet...&lt;/a&gt;&lt;/div&gt;


sap.ui.core.HTML.onAfterRenderingHTML.js:6

When I use the same content and add it as a fixed value in my XML view then this works fine .. and the control is rendered without any issues.



<core:HTML content='&lt;div class=&quot;content&quot;&gt;&lt;h4&gt;Lorem ipsum&lt;/h4&gt;&lt;div&gt;Lorem ipsum dolor sit amet...&lt;/a&gt;&lt;/div&gt;'></core:HTML>


There is clearly something going wrong in the event 'onAfterRendering' which makes me kinda believe that the actual content rendering worked ... but somehow it still breaks ...


I am using version 1.22

Any ideas ?


Kind Regards,


Steven

Accepted Solutions (1)

Accepted Solutions (1)

Steven_UM
Contributor
0 Kudos

Bump ...

Anyone any suggestions ?

Thanks,

Steven

Former Member
0 Kudos

When you're binding the content, you don't have to worry about replacing the special characters. Just set the data in the model as in normal HTML,


<div>Lorem ipsum dolor sit amet..</div>

Steven_UM
Contributor
0 Kudos

Hi

Answers (1)

Answers (1)

Oliver_Baer
Explorer
0 Kudos

Just a hint: I tried to output simple HTML like "123<br>1234" and got the same error as mentioned above, after adding a DIV-tag around it, it works like a charm