Page 1 of 2
RESTservice listview slow
Posted: Wed Jan 15, 2014 3:24 pm
by Hnto
Hello,
I have a question regarding listview data gathered from RESTservice. It all goes very well and the data is shown, however when the listview grows substantially in data the app becomes slow. For example, when the page gathers 100 products. At that moment the app becomes slow in clicking listview items and back buttons etc.
Is there a way to fasten this? Or do I just have to keep listview items to a maximum of 20 or so?
Thank you!
RESTservice listview slow
Posted: Wed Jan 15, 2014 4:21 pm
by maxkatz
The more items you have in the list, the slower it will become. Do you invoke the service each time you go back to the list page?
RESTservice listview slow
Posted: Wed Jan 15, 2014 5:58 pm
by Hnto
Yes, I do. I use page show in order to renew the data each time the user goes to the page because it's a webshop and prices could change. However I am aware of the fact that articles don't need constant updating. What would be the best solution for this, should I invoke service @load and then use javascript to renew the list every 20times or so?
RESTservice listview slow
Posted: Wed Jan 15, 2014 9:18 pm
by Kateryna Grynko
Hi,
It's better to display less records than reload data after 20 views as there can be a lot of time between these views.
Another option is to check if prices changed on page load event, and then invoke a service to update data, else you can use old data.
RESTservice listview slow
Posted: Wed Jan 15, 2014 10:36 pm
by Hnto
Displaying less records is indeed a good option, however the user can use filters to display the desired articles. Some filters show up to 40 items, I understand that that's too much but I have to be able to show those items. I wanna use pagination for this problem, does appery provide a standard solution for pagination from rest service or do I have to program one myself? I could make one myself, but if you know a standard script that would save me a lot of time.
Regarding your second solution, how do I invoke services using javascript?
RESTservice listview slow
Posted: Wed Jan 15, 2014 11:08 pm
by Alena Prykhodko
Have you seen this tutorial http://docs.appery.io/tutorials/build...?
Code to invoke Service via javascript:
preService.execute({});/pre
RESTservice listview slow
Posted: Fri Jan 17, 2014 2:39 pm
by Hnto
Thank you for the code, but it doesn't work. I fill in "myservicename.execute({});" but the app doesn't open the page. The button that takes the user to the page doesn't work when I fill in this code on that page.
RESTservice listview slow
Posted: Fri Jan 17, 2014 3:01 pm
by Maryna Brodina
Hello! Most likely you have incorrect service name. Please check console. Are there any errors?
RESTservice listview slow
Posted: Fri Jan 17, 2014 3:29 pm
by Hnto
The service name is called 'soap'. I invoke the service using "soap.execute({});". I don't think there is an error in that. Maybe a silly question, as I've never used this console option. Where can I find the error console?
RESTservice listview slow
Posted: Fri Jan 17, 2014 3:43 pm
by Kateryna Grynko
Hi,
F12 opens a developer console.