Page 1 of 1

Carousel problem with localStorage information

Posted: Tue Dec 10, 2013 4:49 pm
by vcalero

Hello,

We have a page that displays on a grid the results returned by a service. We also store the results on a local variable, so that the following time the user requests the page, the service is not called, we get the info from the local variable. The code is aprox as follows:
code
if (localStorage.getItem("listResult")!=null){
ResultList_GET.requestOptions.echo = localStorage.getItem("listResult");
ResultList.execute();
}else{
ResultList_GET.requestOptions.echo = '';
ResultList.execute();
}
/code

(on sucess event of ResultList we saved the result in local storage:

code
localStorage.setItem("listResult", JSON.stringify(data));
/code

This work fine. However, we have tried to implement this for the carousel component and we have a problem: The first time, it works ok, but the second time, in line:

code
ResultList.execute();
/code

I recived the next error:
carousel refresh appery.js:243

Uncaught Error: cannot call methods on carousel prior to initialization; attempted to call method 'refresh' jquery-1.8.2.js:477
jQuery.extend.errorjquery-1.8.2.js:477
(anonymous function)jquery.mobile-1.3.0.js:539
jQuery.extend.eachjquery-1.8.2.js:611
jQuery.fn.jQuery.eachjquery-1.8.2.js:241
$.fn.(anonymous function)jquery.mobile-1.3.0.js:535
Appery.ApperyMobileCarouselComponent.$t.TiggziMobileCarouselComponent.$t.TiggrMobileCarouselComponent.$t.createClass.refreshappery.js:2440
(anonymous function)appery.js:882
jQuery.extend.eachjquery-1.8.2.js:611
Appery.RenderVisitor.$t.createClass.refreshComponentappery.js:872
Appery.DataSource.$t.createClass.updateComponentsappery.js:1378
Appery.DataSource.$t.createClass.successHandlerappery.js:1383
Appery.DataSource.$t.createClass.__responseDataHandlerappery.js:1411
proxyjquery-1.8.2.js:775
Appery.RestService.$t.createClass.processappery.js:1554
Appery.DataSource.$t.createClass.executeappery.js:1483
.........

Any hints on what the problem might be?


Carousel problem with localStorage information

Posted: Tue Dec 10, 2013 5:15 pm
by Illya Stepanov

Hello,

Can you post a screen shot of your mapping service ResultList?


Carousel problem with localStorage information

Posted: Wed Dec 11, 2013 1:07 pm
by vcalero

This is a screen shot of my mapping:

Image

Thanks in advance.


Carousel problem with localStorage information

Posted: Wed Dec 11, 2013 6:54 pm
by Maryna Brodina

Hello! Thank you for the screenshot! Could you clarify on what event you invoke the service? If it's Load event please use page Show event instead because Carousel component is not ready on Load.


Carousel problem with localStorage information

Posted: Thu Dec 12, 2013 9:27 am
by Valentín Calero

Hello Maryna!

I invoke the service in a javascript of load page event. The first time works fine, but the second (when services is "mode echo") I recived a error.

I will try to change the event that invoke the service.

I will keep you posted!