Sean Kelley
Posts: 0
Joined: Thu Oct 11, 2012 2:25 pm

"waiting" spinner for populating with REST

I am not sure of the correct terminology for my question. I am trying to show obvious activity on a slower network connection when populating a grid with REST results like the pagination tutorial here:
http://docs.tiggzi.com/tutorials/buil...

My app actually works very well when connected via a descent network, but while waiting for page to load with a spotty 4g service connection, all I see is the next button. There is no spinner and no results. Granted, my results to do include outside web image links and a connection to the tiggzi database.

I tried to mitigate obvious problems by using phonegap to warn users with slow connections. If they are using 2/3g or had no connection then I alert that the app would not work. When the page loads, on event of device ready I run javascript like:

var networkState = navigator.network.connection.type;

var states = {};
states[Connection.CELL_2G] = 'Cell 2G';
states[Connection.CELL_3G] = 'Cell 3G';
states[Connection.NONE] = 'No network connection';

var net=states[networkState]

if (net=='Cell 2G'){
alert('Connection type: ' + states[networkState] +' may be too slow. For best results try wi-fi or 4g network.');
}
...

Is there a better way of showing the display attempt? or perhaps a lack of connection to database or lack of a response?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

"waiting" spinner for populating with REST

You could show "Loading..." message or similar as long as one part of the page is not available yet. You would need to code this solution.

Sean Kelley
Posts: 0
Joined: Thu Oct 11, 2012 2:25 pm

"waiting" spinner for populating with REST

thanks Max- after sleeping on it, I realized it was much simpler than I realized. I added a "loading" graphic on top of page, then added 2 events on data service on success and on error to hide on success:
Tiggzi('loadingImage').hide()
and on error:
Tiggzi('loadingImage').hide()
Tiggzi('failedConnectionImage').show()

these Tiggzi methods of doing things makes it so simple to conceptualize what you need to do and test it quickly.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

"waiting" spinner for populating with REST

Awesome, glad it's working.

Return to “Issues”