locked
Navigator and ListView declarative item templates

    Question

  • It seems there is problem when using ListViews with declarative binding in navigator apps. When the Navigator.js loads the new page fragment, it performs a WinJS.UI.processAll in page.render, however the WinJS.UI.optionsParser for the listviews "{itemTemplate: templateID}" looks for the "templateID" in the current DOM which has not been updated when the processAll call is executed within page.render. 

    Is this a known issue? I cannot believe that it is, and there must be something wrong with my setup:

    I inserted this HTML in the default Navigator app template generated app:

    <div id="logItemTemplate" translate="no" data-win-control="WinJS.Binding.Template">
        <h3 data-win-bind="innerText:name WinJS.Binding.oneTime"></h3>
    </div>
    <div id="itemList" data-win-control="WinJS.UI.ListView" data-win-options="{itemTemplate: logItemTemplate}" data-win-bind="winControl.itemDataSource: dataSource"></div>

    Tuesday, March 05, 2013 4:19 PM

Answers

  • It seems, that one has to use the (poorly documented) "select('#logItemTemplate')" to reference DOM elements when using WinJS.UI.Pages
    • Edited by phil_ke Tuesday, March 05, 2013 4:45 PM
    • Marked as answer by phil_ke Tuesday, March 05, 2013 4:45 PM
    Tuesday, March 05, 2013 4:43 PM