locked
Bug ? Can not create AppBar with javascript ?

    Question

  •  This works :

    <div id="createAppBar" data-win-control="WinJS.UI.AppBar" data-win-options="">
            <button data-win-control="WinJS.UI.AppBarCommand" data-win-options="{id:'commandAdd',label:'label1',icon:'add',section:'global',tooltip:'tooltip1'}">
            </button>
        </div>

    This DOES NOT work:

    var HTMLElement1 = $('<button></button>');
    var appCommand1 = new WinJS.UI.AppBarCommand(HTMLElement1.get(0), {id:'commandAdd', section: 'global', extraClass: 'extraClass1', icon:'add', label: 'label1', tooltip:'tooltip1'});
    
    var HTMLElement2 = $('<div id="createAppBar"></div>');
    var appBar = new WinJS.UI.AppBar(HTMLElement2.get(0), {});
    appBar.commands = appCommand1;
    appBar.show();


    Friday, July 13, 2012 2:28 PM

Answers

  • I fixed the problem, turns out I need to actually have that html elements injected using javascript into inside the body tag.
    Friday, July 13, 2012 3:15 PM

All replies

  • I fixed the problem, turns out I need to actually have that html elements injected using javascript into inside the body tag.
    Friday, July 13, 2012 3:15 PM
  • holy bookmark, it took me 30 minutes ++ to find that "bug".

    Friday, July 13, 2012 3:21 PM