control + data-win-res + WinJS.Binding.Template, WinJS.2.0


  • I found this problem in my custom control which is also reproduced e.g. in WinJS.UI.Rating

    Here is a simple binding template declared in my .html file:
    <div data-win-control="WinJS.Binding.Template">
        <div data-win-control="WinJS.UI.Rating"
             data-win-res="{winControl: {tooltipStrings:['SHorrible','SPoor','SFair','SGood','SExcellent']}}">

    where all the tooltip strings must exist in the resources.resjson file
        "SHorrible": "horrible",
        "SPoor": "poor",
        "SFair": "fair",
        "SGood": "good",
        "SExcellent": "excellent"
    I use the data-win-res for localization and I get an exception "JavaScript runtime error: Unable to get property 'tooltipStrings' of undefined or null reference" in the WinJS.Resources.processAll() call of the .js file.
    The exception occurs in the setMembers function / base.js file.
    Seems that the rating control is not constructed at this moment because it exists in the binding template.
    Any ideas how I can declarative define the tooltips in the template?

    Paul Lambadaris SingularLogic SA

    Wednesday, February 05, 2014 9:55 AM

All replies

  • Without a repro, difficult to tell but here are some hints....

    You can call processall on parts of the DOM so you may be able to delay your process all or call on individual elements.

    Jeff Sanders (MSFT)

    @jsandersrocks - Windows Store Developer Solutions @WSDevSol
    Getting Started With Windows Azure Mobile Services development? Click here
    Getting Started With Windows Phone or Store app development? Click here
    My Team Blog: Windows Store & Phone Developer Solutions
    My Blog: Http Client Protocol Issues (and other fun stuff I support)

    Friday, February 07, 2014 2:45 PM
  • Thanks Jeff,

    Here is a typical demo using the Grip app template. I have modified the 'itemtemplate' in the groupedItems.html page by adding two versions of a rating control: one with the tooltipStrings defined in the data-win-options section and another with the tooltipStrings defined in the data-win-res section.
    The second version produces the exception described above.

    Paul Lambadaris SingularLogic SA

    Saturday, February 08, 2014 6:05 PM