Page 3 of 5

Deleting of items

Posted: Mon Jul 21, 2014 7:19 am
by Lim Samantha

Hi, i am able to delete items now.
However, when i want to delete chocolate (the first item), it will delete the last item instead. why is this so?
And, i would like the list to refresh after i click on the delete button instead of me refreshing it myself. How to do so?
Please assist. Thanks!

http://appery.io/app/mobile-frame?src...


Deleting of items

Posted: Wed Jul 23, 2014 1:17 pm
by Kateryna Grynko

Hi Lim,

On 'delete' button click you should save id from 'itemId' label to a localStorage variable "itemId". Run the following code before running Delete service:prevar itemId = $(this).parent().find("itemId").text();
localStorage.setItem("itemId", itemId);/pre


Deleting of items

Posted: Thu Jul 24, 2014 4:16 am
by Lim Samantha

Hi, so sorry but not very sure what you mean there.

This is me delete service where i link local storage 'itemId' to the _id
Image

and here is where i add the code you provided above, but not sure where should i add in since you say i should run it before running the delete service.
Image

please advise, thank you!


Deleting of items

Posted: Thu Jul 24, 2014 4:33 am
by Alena Prykhodko

On what event do you invoke Delete Service?
Read more about events order here http://devcenter.appery.io/documentat...
Also will be useful http://devcenter.appery.io/documentat...


Deleting of items

Posted: Thu Jul 24, 2014 7:32 am
by Lim Samantha

i used event click button


Deleting of items

Posted: Thu Jul 24, 2014 7:33 am
by Lim Samantha

when i run the code on javascript before running the invoke service, it still does not work. (does not auto refresh)


Deleting of items

Posted: Thu Jul 24, 2014 9:47 pm
by Yurii Orishchuk

Hi Lim,

You need to populate by given code "click" JS event handler for your "Delete" button.

To refresh list you should invoke your "list/query" service on "success" event for "delete" service.

Regards.


Deleting of items

Posted: Fri Jul 25, 2014 5:36 am
by Lim Samantha

Hi, it works now. but when i want to delete the first item or any other item except the last item, it will always delete the last item. why is this so?

please try it here :

http://appery.io/app/mobile-frame?src...


Deleting of items

Posted: Sun Jul 27, 2014 7:56 pm
by Alena Prykhodko

Samantha,

Please tell steps to test.
Do you get any error in console?


Deleting of items

Posted: Tue Jul 29, 2014 4:36 am
by Lim Samantha

Hi,

Please type in some items and try to delete the first item on the list.
(It will delete the last item instead)

Thanks