Asked by:
Binding html text to innerHTML inside a template

Question
-
I have a flipview which references a Template. Inside the template I would like to set the innerHTML property on a div. My datasource backed by an indexeddb database. The data source consists of html fragments which are then populated in the flipview via the innerHTML property.
<div id="simple_ItemTemplate" data-win-control="WinJS.Binding.Template"> <div data-win-bind="innerHTML: canvas"> </div> </div> <div id="simple_FlipView" style="display:none;" class="flipView" data-win-control="WinJS.UI.FlipView" data-win-options="{ itemDataSource: ReaderStoryList.datasource, itemTemplate: select('#simple_ItemTemplate') }"> </div>
This was working fine until I started adding 3d transforms in the html fragments. Now I get the error:
Unable to add dynamic content. A script attempted to inject dynamic contet...
What I want to do is apply MSApp.execUnsafeLocalFunction around the binding of the template. Is this possible? Or is there any other way I can workaround this error?
Saturday, June 8, 2013 10:34 PM
All replies
-
Cannot you use a converter to do this ?
- Girija
Please mark responses as answered if it helped you.. This helps others... - Girija Shankar Beuria
Monday, June 10, 2013 3:45 PM -
Thanks for the response. I went ahead and implemented my own slider as a workaround. I'm not sure if the converter would work, because all it is doing is converting the data getting pulled back by the datasource. This itself is not directly causing the error. The error comes in is when the innerHTML property gets set. I'm sure this is deep in the flipview object but somehow I need to access to this so that I can wrap it with MSApp.execUnsafeLocalFunction.Tuesday, June 11, 2013 4:05 AM
-
Cannot you just use toStaticHTML ? wrap this code in a converter ...
- Girija
Please mark responses as answered if it helped you.. This helps others... - Girija Shankar Beuria
Tuesday, June 11, 2013 7:07 AM -
I tried toStaticHTML, but it removes the 3d transforms out the html fragments. The 3d transforms need to be in the html fragments.
- Edited by bmurmistro Tuesday, June 11, 2013 11:11 AM
Tuesday, June 11, 2013 11:11 AM