Page 1 of 1

Pass id from a page to a page that use service with parameter {id} in URL.

Posted: Sat Sep 13, 2014 6:46 pm
by SydBarrett

Hi all,

I'm trying to create an app with two pages:
Starting page with a list of items linked to the second page of the app with specification of that item.
Example:
Page one
item 1
item 2
item 3

When I click on item 1 I will go to another page with details of item 1
Item 1 title
item 1 body

All results are on my server with a backend service.
mysite.com/list contains a list of all items
mysite.com/list/id contains details of the selected item where id is the id of the item
(mysite.com/list/1 contains details of item 1 etc...)

I've followed this tutorial:
http://devcenter.appery.io/tutorials/...

I've been able to create both services:

  • List: mysite.com/list with no requests

  • Item: mysite.com/list/{id} with id request
    Both of them have been tested and are working as expected in the test tab.

    I've been able to see a list of items, but when I click on the item the second page returns undefined for both field Title and Body.

    Is there anything I'm missing in the way I do pass the parameter from one page to another.

    Also, is there a better way to pass the item ID from a list to his page.

    Thanks in advance.


Pass id from a page to a page that use service with parameter {id} in URL.

Posted: Mon Sep 15, 2014 1:39 am
by Yurii Orishchuk

Hi Syd,

It's hard to say what is wrong in your implementation.

Because there is a chain of thing which you have to implement:

1 To to the list item hidden label component (with name "itemId").

2 Populate this label with item id corresponding to this list item.

3 On list item click you need to save value(text) from this label to "itemId" LSV at first. Second event - navigate to page. These events should be in this order.

4 On second page "item" datasource you should add link from "itemId" LSV to "_id" request parameter.(this parameter will passed to your URL).

That's briefly description of all steps that you can found in http://devcenter.appery.io/tutorials/... tutorial.

If you can not manage to solve this problem please give us your app public link and describe steps to reproduce this problem.

Regards.


Pass id from a page to a page that use service with parameter {id} in URL.

Posted: Mon Sep 15, 2014 7:50 pm
by SydBarrett

Hi Yurii,

thanks for your response.

I've actually found the problem, I've named the localStorage variable "id" rather than "_id". This change has fixed the issue and now I'm able to get the single node.

Thanks again.