vcalero
Posts: 0
Joined: Wed Nov 13, 2013 12:20 pm

Carousel problem with localStorage information

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?

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Carousel problem with localStorage information

Hello,

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

vcalero
Posts: 0
Joined: Wed Nov 13, 2013 12:20 pm

Carousel problem with localStorage information

This is a screen shot of my mapping:

Image

Thanks in advance.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Carousel problem with localStorage information

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.

Valentín Calero
Posts: 0
Joined: Thu Dec 12, 2013 9:27 am

Carousel problem with localStorage information

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!

Return to “Issues”