locked
About to go crazy. Listview with html content template (ie iframe, pagecontrol, htmlcontrol)

    Question

  • I'm working on my first Windows 8 style app with html5/javascript. I have three html pages (or sections as I like to call it)  they are featured, blog, images.

    I want to use each of these in a listview on the "home" page. So I've created a listview on the home page: 

    <div id=navListView" class="itemsList" aria-label="list of groups" data-win-control="WinJS.UI.ListView" data-win-options="{itemDataSource: myContent.dataSource, itemTemplate: select('navItem')}"></div>

    Above that I have an item template:

    <div id="navItem" data-win-control="WinJS.Binding.Template">

    <div><iframe data-win-bind="src: content"></ifram></div>

    </div>

    Then in my Home.js file I have this:

    var myContent = new WinJS.Binding.List([

    {title: "featuredContent", content: "/controls/featuredContent.html"},

    {title: "blogContent", content: "/controls/blogContent.html"}

    ]);

    Okay so. now when I run this I get this error about WINJS.Utilities.requireSupportedForProcessing......

    Value is not supported within a declarative processing context......

    I've tried using iframe, HTMLContent(), as well as using javascript to just render the HTML pages to the listview.

    Why is this so hard? What is the correct way of building an application that will have 3 different distinct sections on the main page that will be scrolled from left to right?  Should I not use a listview? 

    Thanks in advance

    Friday, August 31, 2012 5:56 PM

Answers

  • You're not crazy, binding against iframes is not supported (for security reasons). You can get around this by creating your own binding action:

    window.setSrc = WinJS.Binding.initializer(function (src, srcProps, dest) {
        dest.src = WinJS.Utilities.getMember(srcProps.join('.'), src);
    });
    

    <iframe data-win-bind="src:href setSrc"></iframe>

    Friday, August 31, 2012 8:43 PM

All replies

  • You're not crazy, binding against iframes is not supported (for security reasons). You can get around this by creating your own binding action:

    window.setSrc = WinJS.Binding.initializer(function (src, srcProps, dest) {
        dest.src = WinJS.Utilities.getMember(srcProps.join('.'), src);
    });
    

    <iframe data-win-bind="src:href setSrc"></iframe>

    Friday, August 31, 2012 8:43 PM
  • Thanks a lot , i wasted a day figuring out a solution
    Sunday, February 17, 2013 10:36 AM