Lim Samantha
Posts: 0
Joined: Wed Jun 11, 2014 6:50 am

Deleting of items

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...

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Deleting of items

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

Lim Samantha
Posts: 0
Joined: Wed Jun 11, 2014 6:50 am

Deleting of items

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!

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Deleting of items

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...

Lim Samantha
Posts: 0
Joined: Wed Jun 11, 2014 6:50 am

Deleting of items

i used event click button

Lim Samantha
Posts: 0
Joined: Wed Jun 11, 2014 6:50 am

Deleting of items

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

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Deleting of items

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.

Lim Samantha
Posts: 0
Joined: Wed Jun 11, 2014 6:50 am

Deleting of items

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...

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Deleting of items

Samantha,

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

Lim Samantha
Posts: 0
Joined: Wed Jun 11, 2014 6:50 am

Deleting of items

Hi,

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

Thanks

Return to “Issues”