Page 1 of 2

Clickable list

Posted: Thu Dec 19, 2013 11:10 am
by Bert Vandenbogaerde

Hello,

I am totally new to this.

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

Tab: Menu

I try to create a clickable list.
The list items are populated from the appery DB.
I follow this tutorial:
http://docs.appery.io/documentation/b...

I get it to work untill the "local storage variable".

But i get lost with these steps:

  • Now that the value is stored in local storage, you can use it on the next page or any other page in the app.

  • Because the local storage variable was created via an action, you don’t need to create it by hand for mapping. Mapping the id for service invocation:

  • When you navigate to the next page, you can invoke the service on page show event.

    do i have to create a new collection with the detail information?
    How do i link the specific list id to the specific details for that list id.


Clickable list

Posted: Thu Dec 19, 2013 12:21 pm
by Maryna Brodina

Hello!
[quote:]do i have to create a new collection with the detail information[/quote] it's up to you, you can add new field in existing collection or create a new one
[quote:]How do i link the specific list id to the specific details for that list id[/quote]you can use Pointer field type http://docs.appery.io/documentation/b... (see Data Types section). You can use where clause in the request http://docs.appery.io/documentation/b... (Query Constraints)


Clickable list

Posted: Thu Dec 19, 2013 12:56 pm
by Bert Vandenbogaerde

I am trying to understand but it does not work for me.

This is my DB structure on appery:

_id section (string) detail (string) acl _createdAt _updatedAt

the values in "section" are populated in the list (on the "menu" page). That works fine.
Now i want that when i click on a list item, it goes to a page called "detail" and opens the "detail" value corresponding to the list item i clicked.


Clickable list

Posted: Thu Dec 19, 2013 1:58 pm
by Maryna Brodina

Do you have this information with detail? Looks like there is no info in this collection? Do you have any other collection? You can add column for detail in existing collection.


Clickable list

Posted: Thu Dec 19, 2013 2:02 pm
by Bert Vandenbogaerde

Image

All the info is in the DB collection.

I would like the values in the detail column to display on my detail page when i click a list item (section column).


Clickable list

Posted: Thu Dec 19, 2013 2:28 pm
by Maryna Brodina

On detail page you have to add object id in url (here is more information http://docs.appery.io/documentation/b... - Retrieve a specific object). So

  • service URL should be pre{database_url}/collections/MenuSection/{obj_id}/pre- in request parameters add obj_id
  • do mapping from localStorage variable where you store object _id to obj_id.

Clickable list

Posted: Thu Dec 19, 2013 4:41 pm
by Bert Vandenbogaerde

I am getting close.

Now i linked the obj_id to the URL:

Image Image Image Image

as you can see, i get undefined message...

I think i get close :)


Clickable list

Posted: Thu Dec 19, 2013 6:41 pm
by Kateryna Grynko

Hi Bert,

1) How do you save a value in 'itemId' variable?
2) You should also send Session token as a Request parameter: http://docs.appery.io/documentation/b...


Clickable list

Posted: Thu Dec 19, 2013 7:05 pm
by Bert Vandenbogaerde

1)
Through local storage variable, the action takes place when a list item is clicked

2)
X-Appery-Session-Token is visible on the request tab.
With what value does it have to be connected?
Does it have to be connected on my main page mapping or on the detail page mapping?


Clickable list

Posted: Thu Dec 19, 2013 8:43 pm
by Kateryna Grynko

Bert,

1) Please make sure the variable is set correctly.
2) On page 'detail' (your screenshot of mapping without session token) please check if there are any errors in console again (F12).