Kinson Sa
Posts: 0
Joined: Sun Mar 22, 2015 9:40 pm

Data count value during listitem mapping

Dear friends,

I was reading a lot and I did not find it.

What I need to do is the following:

I have array in local storage, and then I do mapping to list.

As I have nearly 500 products it take time for the user, and I would like to make a visible counting down from this mapping, so the user knows more or less how many products waiting untill he can see them in the list.

Now I have label visible (WAIT PLEASE PRODUCTS ARE NEARLY SHOWING), but I preffer counting down.

Please important the counter value of listitem is used to show stock of product.

Some js code will be great. Thanks Image

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Data count value during listitem mapping

Hello,

Unfortunately we have no such JS. But you can count elements with JS below:

var length = $("[name=listItemName]").length;

E.g. refresh this variable every N ms.

Kinson Sa
Posts: 0
Joined: Sun Mar 22, 2015 9:40 pm

Data count value during listitem mapping

Thanks, can you tell me how to refresh variable in ms.

My JS is not so good.

Thanks

Kinson Sa
Posts: 0
Joined: Sun Mar 22, 2015 9:40 pm

Data count value during listitem mapping

Dear I try everything and nothing. My java is not as good.

Anyway I want to ask for something. I have one button to get data from rest api and put it in storage array.

Then I get this storage array and I put it in a list.

The problem is that when salesman press get all information they know they have to wait as I'm getting new stock for everything.

But as there are arround 500 products and each product with 6 storage variable, it is a lot of data to include it in the list.

So it takes depending on the mobile arround 30 to 60 seconds. Now with the data-filter-reveal, as list do not have to show products until filter, it is little faster.

My question is, it is possible that when they open or close app this list always with data, until they click to get all information again.

Thanks

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Data count value during listitem mapping

Could you check the same functionality on the AngularJS/Bootstrap project? It can be much more faster than jQuery mobile

Kinson Sa
Posts: 0
Joined: Sun Mar 22, 2015 9:40 pm

Data count value during listitem mapping

Dear Friends,

This is my JS code before mapping

var timeoutID;

function delayedAlert() {
timeoutID = window.setInterval(slowAlert, 1000);

}

function slowAlert() {
Apperyio.storage.contador.set(Apperyio.storage.contador.get()-1);
Apperyio("CARGANCO_PRODUCTOS").text(Apperyio.storage.contador.get());
}

function clearAlert() {
window.clearTimeout(timeoutID);
}
delayedAlert();

This works perfect during it is not doing any mapping, but when it is mapping this do not refresh or do nothing.

When mapping finish, You can see working again. So I do not know what to do.

Please if you have soming clear to do with it ok, if not, just please take note to try to implement something for when geting information see some counting value or a loading bar so people can see how many time they have to wait when mapping all data.

Thanks

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Data count value during listitem mapping

Hello Kinson, I am sorry, not sure I understand you correctly. Where do you run that JS code?

Kinson Sa
Posts: 0
Joined: Sun Mar 22, 2015 9:40 pm

Data count value during listitem mapping

Dear,

A buton start this counter. Just imagine I put contador =60, so this code every second will change and the label will also change de number.

Apperyio.storage.contador.set(Apperyio.storage.contador.get()-1);
Apperyio("CARGANCO_PRODUCTOS").text(Apperyio.storage.contador.get());

That is ok. I check this with a button and it works perfect.

Then what I do is the same buton after start this JS, it also start mapping from API to storage.

When it is maping the

Apperyio("CARGANCO_PRODUCTOS").text(Apperyio.storage.contador.get())

does not change in the page.

Then after mapping, you can see the label arround -30, and changing every second.

So that means that it works, but when maping everything on the page do not refresh.

So it is not possible to show to the user charging all data. I underestand that when you have to wait for 5 seconds it is ok, but if you have to get arround 450 products and they have to wait for 45 or 70 seconds depending on their connection it's not usefull.

I just tell if someone knows how to make that i NEED SOME HELP. And also if you can send to programmers to implemment some charging bar for mapping and getting data.

Thanks

Pedro

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Data count value during listitem mapping

You can invoke service directly, without storage variable: https://devcenter.appery.io/documenta...
I can reduce time of execution.
Also, you may consider purchasing Advisory Pack to get more in-depth help on this question. Here is more information about Advisory Pack (http://appery.io/services/#Advisory_Pack).

Return to “Issues”