locked
How to display dynamic listView for each Hub section?

    Question

  • I'm creating new project using template Hub App. The hub will have 3 sections, each section will have listView control to display items which I call from the web server. Section 1 will show Most popular items, Section 2 will show Top rated items, Section 3 will show Newest items. What is the correct way to get data from web server? Should I use WinJS.xhr 3 times to connect to server via 3 urls popular.php, toprate.php, newest.php to retrieve json data to bind it with 3 list view control?

    Thanks

     
    Sunday, November 24, 2013 5:37 AM

Answers

  • Hi Khoi Hong,

    1) What is the correct way to get data from web server?

    There are pretty much way to fetch the data from web server, use WinJS.xhr is a good choice. Also  Windows.Web.Http.HttpClient  is a good option.

    2) Should I use WinJS.xhr 3 times to connect to server via 3 urls popular.php, toprate.php, newest.php to retrieve json data to bind it with 3 list view control?

    Of course you can, WinJS.xhr is similar like ajax, after fetch the date from server, bind them to the listview is a good approach. The hub control sample shows how to bind data to the listview control in hub section control

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, November 25, 2013 6:54 AM
    Moderator