locked
Creating ListView by code failed RRS feed

  • Question

  • Hi, 

    I need to create a WinJS ListView control by using code. Here is how I try to do it:

    var list = WinJS.UI.ListView(this.contentContainer, []);

    The "this.contentContainer" is a HTML DIV element. 

    However, I got an exception immediately.

    The exception happened at line 21127 of ui.js:this._loadingState = this._LoadingState.complete;, because the "_LoadingState" is null.

    Any suggestions? Thanks a lot.

    cheers

    Alex


    woodhead is as woodhead does



    • Edited by Alex ZS Monday, November 19, 2012 6:47 AM
    Monday, November 19, 2012 6:46 AM

Answers

  • Hi,

    Please using document.getElementById("divid") instead.

    Any more question, please feelf free to reply.


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com
    Microsoft One Code Framework

    • Marked as answer by Song Tian Wednesday, November 21, 2012 2:58 AM
    Monday, November 19, 2012 7:54 AM

All replies

  • Hi,

    Please using document.getElementById("divid") instead.

    Any more question, please feelf free to reply.


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com
    Microsoft One Code Framework

    • Marked as answer by Song Tian Wednesday, November 21, 2012 2:58 AM
    Monday, November 19, 2012 7:54 AM
  • Hi Song,

    Thanks for your replying. 

    I just noticed my super stupid mistake, I didn't add the "new" keyword when I create the listview.  

    I already have the "this.contentContainer" variable assigned before I create the listview. Anyway, thank you very much, and feel free to delete this useless article.

    cheers

    alex


    woodhead is as woodhead does


    • Edited by Alex ZS Tuesday, November 20, 2012 11:42 PM
    Tuesday, November 20, 2012 5:57 AM