2

is there a way to trigger the loading animation of a ListView manually?

I load some data on start up from a web service and would like to display a busy indecator.

 function searchData(url) {

        var promise = DataService.getData(query);

        promise.done(function (result) {
            console.dir(result);
            var bindingList = new WinJS.Binding.List(result);

            sectionListView.winControl.itemDataSource = bindingList.dataSource;

        });
    }

this is what I do in app.onactivated

promise = WinJS.UI.processAll();
        promise.done(function () {
            searchData(query);
        });
        args.setPromise(promise);

I read something that ListView should display busy animation while waiting for a promise... Is this true? Or is this something I have to do manually... display and hide a div whenever needed?

Thanks for any help...

2 Answers 2

1

According to this thread, the progress ring will only appear if the ListView is hooked up to an asynchronous data source, while the WinJS.Binding.List is synchronous. I don't think there are any asynchronous data sources available by default, so you would have to set up a custom data source to be able to get that default progress ring. I would recommend just setting a progress ring to run when your app starts and removing it in the done block of your data promise.

1
  • Do you have an example? Because I have a service with an async method and I am binding the result as binding list because I thought this is what ListView wants/needs. How would look the async data source? Jan 25, 2013 at 18:58
1

You need to create your own custom List Data Source. WinJS provides the utilities to do this pretty easily. This is a good sample against the Bing web service. If you need more samples of how to write your own Data Source / Data Adapter let me know, I've written a few.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.