kay
Posts: 0
Joined: Fri Oct 31, 2014 2:24 pm

Lesson 7 : Building an App with a Clickable List Using Model and Storage

Help - I have recreated this example several times but I can't seem to select any other records from the database table other than the first one. It seems to be this part of the code which is causing the problem:

element.on("click", function () {
Apperyio.storage.variable_name.set(value);
});

Can anyone shed any light on why this could be happening?

https://www.youtube.com/watch?v=Kehn1...

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Lesson 7 : Building an App with a Clickable List Using Model and Storage

Hi Kay -

Sorry, but it is not clear what exactly is not working in your app.
Could you please clarify your question?

Have you created Model with structure that replicates your database data? Are you using correct data types for your Model?

kay
Posts: 0
Joined: Fri Oct 31, 2014 2:24 pm

Lesson 7 : Building an App with a Clickable List Using Model and Storage

Hi Illya,

Yes I have created the structure and it replicates the database data. I think I have correct data types for the model. See images:

Image

Image

The issue is: when I click on the list of items to select one record, no matter what list item I click on I only get the first item in the list.

Okay - with further debugging analysis it appears that the listitem when selected is calling on an old database which I deleted.

Image

I've gone through the process of clearing cache on browser using the following methods.

chrome://appcache-internals/
“Disable cache” check box

I know it it still calling the deleted database as the member number 11111111 only exsisted in this database. The member numbers are very different in the new database.

I have created new services for the new database and deleted the old services too.

Any advice on how to resolve this would be great!

Thanks

Kay

kay
Posts: 0
Joined: Fri Oct 31, 2014 2:24 pm

Lesson 7 : Building an App with a Clickable List Using Model and Storage

Further investigation:

I can see from the debug window that it is picking up the new database and correct record when I click on the listitem, but it still displays the first listitem in the database.

Image

kay
Posts: 0
Joined: Fri Oct 31, 2014 2:24 pm

Lesson 7 : Building an App with a Clickable List Using Model and Storage

Deleted all databases and started again, this must be something really straight forward I am not getting right as I am still only getting the first record from the database.

These are the steps I have followed:

App - Model & Storage

First Page - Main

User Interface
List - 1 Item

Second Page - Details

User Interface
List - required No of Items

Model & Storage

Model Name Model Type

Member Object

name
surname
mobile
email
etc

Model Name Model Type

MemberList Array

MemberList Member

Storage

Add 2 storage variables

Model Name Model Type

members MembersList
selectedMember Member

Create Database

Ensure naming conventions are relative
Input a few records

Services

(1) Create New

(2) Database Service

(3) Select Database

(4) Import Services

Read - specific item in the database
List - all content

Add Services - List Service Success Mapping

From Main Page

show_list_of_members
Success - Mapping

Read the data from the Service to the Storage

Service Response map to Storage members

Add another Success Mapping

Activate Storage - Read the data from the Storage to the Page

members map to List Item
fullname map to Text

Switch - 1st Page Design

Select Page in breadcrumbs
On Page Load - Invoke Service - show_list_of_members

Add the Javascript to 2nd Success Mapping

Enter JScript on ListItem of members

element.on("click", function () {
Apperyio.storage.selectedMember.set(value);
});

Switch to Design View

Select ListItem - on click Navigate to Details Page

Details Page Design

Details Page - Page Show - Invoke Mapping

Activate Storage - Read the data from the Storage to the Page

Map the storage variables to the listItems Text field

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Lesson 7 : Building an App with a Clickable List Using Model and Storage

Hello Kay,

Could you please clarify have you get this tutorial working if you download a backup of this project from here:
https://devcenter.appery.io/building-...

kay
Posts: 0
Joined: Fri Oct 31, 2014 2:24 pm

Lesson 7 : Building an App with a Clickable List Using Model and Storage

Hi Evgene,

Yes the tutorial worked fine.

I am not sure if my App and Database example are corrupt, because I have been implementing so many trial and error actions.

I also noted that when I tried to make another Model and Storage Array the system did not generate the Array automatically. After I added the variable, it set the value in the RepsList Array to [0] other than .

Image

kay
Posts: 0
Joined: Fri Oct 31, 2014 2:24 pm

Lesson 7 : Building an App with a Clickable List Using Model and Storage

Hello Evgene,

Can you see where I've gone wrong?

I'm keen to get this situation resolved, as I fear that I am working with corrupt files and do not want to waste time continuing to build this App up, if it has been messed with too much.

kay
Posts: 0
Joined: Fri Oct 31, 2014 2:24 pm

Lesson 7 : Building an App with a Clickable List Using Model and Storage

I also noticed that the Model and Storage download method is quite different in how it gets the records: It uses a block of JScript to implement the call to the individual records.

It's quite different from the Model and Storage and getting records from the database.

I would prefer to get the first version of getting the records from the database than implementing the one with JScripting.

Can you help me with this?

kay
Posts: 0
Joined: Fri Oct 31, 2014 2:24 pm

Lesson 7 : Building an App with a Clickable List Using Model and Storage

Resolved - Thanks to Max's eagle eye!

Silly human error - I had linked the individual record to read out instead of the array of records on the details page mapping section.

Thanks for all support offered!

Return to “Issues”