Sunita
Posts: 0
Joined: Sat Nov 15, 2014 2:40 pm

Add an item from one list on one page to another list on a different page.

So I have a list of items with their name and an image that is being read in from the database via rest services. When I click on an item in this list, it takes me to a details page giving information about the item and there is a add button as well. I want to make that add button work, so that when I click on it it should add that item to another list, and it should basically display the same name and image as it was in the original list.

Sunita
Posts: 0
Joined: Sat Nov 15, 2014 2:40 pm

Add an item from one list on one page to another list on a different page.

Hi Arina,

That tutorial shows how to move from one page to the other.
My question is not relevant to that tutorial.

Can you please help otherwise?

Sunita
Posts: 0
Joined: Sat Nov 15, 2014 2:40 pm

Add an item from one list on one page to another list on a different page.

Can someone please help me out with this?

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

Add an item from one list on one page to another list on a different page.

Hi Sunita,

You just need to create datasource for list service with filter by needed item _id.

Here is brief plan for it:

1 On button click - you should store(if it not stored before) goal item "_id" to some lsv.

2 On next page - you should add list service. And in mapping "before send" click on "JS" for "where" parameter and populate it with following code:

pre

//Where "youLSVName" is your lsv name.
var id = localStorage.getItem("youLSVName");
var whereObject = {"_id": objectId};

return JSON.stringify(whereObject);

/pre

3 On next page, "page show" event - you should invoke list service from 2nd step.

Also please pass this tutorial if you don't know how to work with local storage.

Regards.

Sunita
Posts: 0
Joined: Sat Nov 15, 2014 2:40 pm

Add an item from one list on one page to another list on a different page.

Hi Yurii,

Thank you for your reply.

I think what you have mentioned above is how to list the items from the DB, and if i click on them it takes me to their details page. I already have that working.

What i was asking is that i have an "add" button on that details page. When i click on that add button, it should add and list that specific item to another page.

Can you help me with this?

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

Add an item from one list on one page to another list on a different page.

Hi Sunita,

Nope, in above answer - i told about how to populate list with item you need.
So you need to populate list item with item with id stored in LSV.

Please follow given plan above.

Regards.

Sunita
Posts: 0
Joined: Sat Nov 15, 2014 2:40 pm

Add an item from one list on one page to another list on a different page.

Hi Yurii,

Yes, that is what i meant. I already have that working. I have a page with a populated list of items.

What I need to know is, when I click on one of those items (mentioned above), it takes me to their details page (which I have working as well). Now, this details page has a "Add" button. I want it to function in a manner that if I click this add button, the app should add this item to another page.

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

Add an item from one list on one page to another list on a different page.

Hi Sunita,

Here is workFlow what i talked about:

pre

Listpage_1 - click on list1_item - detailsPage_1(listPage_2) - click on list2_item - detailsPage_2

/pre

So you should do the same. When clicked on "list2_item":
1 store lsv(like you do it on click "list1_item").
2 navigate to "detailsPage2" (like you do it on click "list1_item").
3 invoke list service on "detailsPage2" with filter by LSV from 1st step. This service will populate your goal list.

Regards.

Sunita
Posts: 0
Joined: Sat Nov 15, 2014 2:40 pm

Add an item from one list on one page to another list on a different page.

Hi Yurii,

I want to clear this out with you.

So i have a list of vegetables.

Image

When i click on one these items, it takes me to its details page:

Image

You see that + My Veg button on top right corner. When i click on it, I want this particular vegetable to be added as a list item to another page called My Veg:

Image

Return to “Issues”