locked
List view not updating

    Question

  • Am developing app in grid template.

    i used web service as below to load data.

     WinJS.xhr({ url: "Here is my url" }).then(function onComplete(xhr) {
                           var alert = JSON.parse(result);
            // Add the items to the WinJS.Binding.List
            alert.forEach(function (item) {
                listFav.push(item);
            });

        },
        function onError(err) {

        }); 

    it works fine. but if some data added to the database(not from the apps) after the start of application is not reflecting in the list.

    even i have tried of calling the set of lines programmatically but it doesn't work.

    any answers are very appreciable and thanks in advance.

         
    Thursday, March 27, 2014 8:47 AM

All replies

  • Are you getting the latest set of data from the database when it's updated?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, March 27, 2014 1:13 PM
    Moderator
  • thank for the reply.

    if i close the app and run it again am getting the latest data. But while navigating from page to page am not getting the data which are added concurrently.

    how i can make my list view in app always have the latest set of data from the database.

    Friday, March 28, 2014 3:58 AM
  • You have to run that code every time you want updated data.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Friday, March 28, 2014 1:45 PM
    Moderator
  • thanks.

    I have tried for that also for the first time it got executed on start of the application, if i call it for the second time while page navigation its not hitting tat method(even if make the function call programmatically in that flow)

    Monday, March 31, 2014 3:48 AM
  • I am confused.  The only way to display updated information is to get it first. There's no magic method which automatically updates the record set when navigating between pages.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Monday, March 31, 2014 1:29 PM
    Moderator
  • am using setInterval to call tat method again n again. 

    the adding of records to the database happens through website(this is different process it can happen at any time)

    the method which setInterval calls first time if its giving me 5 records.(lets assume now one record is add to DB through website)

    for the second time it should give 6 records. but am getting only 5 records again.

    I hope u got the problem am facing.

    thanks.

    Tuesday, April 1, 2014 3:47 AM
  • Where is the setInterval method? If you're navigating between pages, then the setinterval will go out of scope.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Tuesday, April 1, 2014 1:18 PM
    Moderator