locked
are changes to the data source of controls detected and updated automatically

    Question

  • Hi, In the SplitExample project template that Visual Studio 11 has, the data source to the 'ListView' as shown in the html section below (you can find it in splitPage.html) is provided by 'splitPage.items' array of objects. This array is initialized with hard-coded data in the function 'getItems()' of splitPage.js. This function is called as soon as the page is loaded. What I want to do is to initializes the 'splitPage.items' array, which is the data source of the 'ListView' with data I extract from a local XML file. But loading the file into a DOM, and then parsing the DOM are asynchronous functions, and the 'spligPage.items' array may get updated after the page has loaded. What is happening right now with my code is that I parse the xml and initialize the 'splitPage.items' array in the 'then' part of the promise method, which happens asynchronously, but I am not seeing the data being updated in the ListView control. This leads me to believe that the ListView control does not automatically sense changes in the datasource. Is this true? If this is the case, then, how can I sense when the dataSource has changed and refresh the display of the ListView? thanks <section class="itemListSection">
    </section> thanks
    Wednesday, December 7, 2011 2:44 AM

Answers

  • Thanks Jeff, that was a very useful video. Some sample code for that video is in the "Custom Data Sources Example" Sample project, in case anyone wants to see some of the examples.
    • Marked as answer by mesarina Wednesday, December 7, 2011 10:29 PM
    Wednesday, December 7, 2011 10:29 PM

All replies

  • This talk will give you all the info you need!  I recommend viewing the whole thing.  At 14:00 he talks specifically about this however: http://channel9.msdn.com/events/BUILD/BUILD2011/APP-210T

    -Jeff

     


    Jeff Sanders (MSFT)
    Wednesday, December 7, 2011 7:37 PM
    Moderator
  • Thanks Jeff, that was a very useful video. Some sample code for that video is in the "Custom Data Sources Example" Sample project, in case anyone wants to see some of the examples.
    • Marked as answer by mesarina Wednesday, December 7, 2011 10:29 PM
    Wednesday, December 7, 2011 10:29 PM