leonardo
Posts: 0
Joined: Thu Mar 14, 2013 7:04 pm

Problem with returning Storage Value to a page Element

I store a cliked value of a listitem to a localstorage from Page 1. I navigate on a Click event to Page 2, which has the following textlabels on a listitem: tid, aid, spg, The textlabel "aid" correponds to the value of the data I am trying to filter. But I have 2 problems here:

  1. All the data show if I test the data response with a static value:
    code{"aid": "John Doe"};/code

    So, I put the following code in the JS in the Storage/Where mapping:
    codevar result = localStorage.getItem("myaid");
    alert("Local Storage received: " + result); //Gives correct data
    return {"aid": myauthor};
    /code

    But this gives blank page. If I delete the Storage mapping, all data show up.

  2. I need to get the value of each of the text fields inside the listitem on Click event . This Click JS:
    codealert("tid: " + Apperyio('tid').text());/code

    only gives the text of the first item and not the particular one clicked.

    I appreciate your help on these 2 situations.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Problem with returning Storage Value to a page Element

Hello,

1) Sorry, I don't understand that question. Could you clarify what you have tried and what exactly does not work?

2) Please use JS below for that:
prealert("tid: " + element.text());/pre

leonardo
Posts: 0
Joined: Thu Mar 14, 2013 7:04 pm

Problem with returning Storage Value to a page Element

Hi Sergiy,
That code didn't work. No alert box was triggered by that code.

On 1, here are images of what I have done, which displays nothing on the page:
Image

Image

Image

Here, the localStorage value was set from another page before navigating to this page. The storage variable is correctly carried to this point when tested. But it doesn't filter the records on the page. The direct test shown in the storage mapping correctly filters the records on the page. But returning the value of the storage doesn't work and filters nothing, giving a blank page:

codereturn {"aid":myauthor};/code
Hope that is clear.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Problem with returning Storage Value to a page Element

Please show us screenshot from that database collection. Does it have a collection aid?
Please check if there are any errors in the browser console. You can learn here: https://devcenter.appery.io/documenta... how to open the console.

leonardo
Posts: 0
Joined: Thu Mar 14, 2013 7:04 pm

Problem with returning Storage Value to a page Element

Hi Sergiy:
Yes, there is "aid" column in the collection.
When I tested it in console, it shows that the storage, "myauthor" was empty. I had it defined in storage only and not in Model. Once I created a model with that name, the storage is populated in console.
However, it is still showing empty. I am getting the following error in console:

Image

Apart from the fact that nothing is showing for that page, I am still not getting the text of the clicked item as explained above. So, I'm still stuck on the 2 issues.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Problem with returning Storage Value to a page Element

1) Please use Appery.io Storage variable (https://devcenter.appery.io/documenta...) instead of the localStorage directly.

2) This is just a warning, don't warry about it.

leonardo
Posts: 0
Joined: Thu Mar 14, 2013 7:04 pm

Problem with returning Storage Value to a page Element

It is still not working and I am getting frustrated. The app name is "Mimag" and I have shared it with support.

Please note the 2 issues I've been asking about:

  1. Filtering the data to the storage variable from the previous page.

  2. Getting the value of each of the text fields inside the listitem on Click event.

    Also, please don't show the data publicly. Thanks.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Problem with returning Storage Value to a page Element

Unfortunately debugging custom JS code is something outside the scope of standard Appery.io platform support. You may consider purchasing Advisory Pack to get more in-depth help on this question. Here is more information about Advisory Pack (http://appery.io/services/#Advisory_Pack).

leonardo
Posts: 0
Joined: Thu Mar 14, 2013 7:04 pm

Problem with returning Storage Value to a page Element

This is interesting! This is a mapping situation that's supposed to work within your platform and is not. We are talking about Apperyio storage and things.

What in the world is happening here? After 5 days for a simple problem this is what I get?

I'm not asking you to debug a custom JS code. I'm asking why is it that the native codes are not working. I've given you all that you asked for. The storage is showing that it could be assessed from the page, but nothing is happening there. And nothing is happening to give the text of the label within the listitem in the previous page either.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Problem with returning Storage Value to a page Element

Please use JS code below on the parameter "where":

prereturn {"aid": Apperyio.storage.selauthor.get().trim()};/pre

The issue is related with extra symbols in the storage variable.

Return to “Issues”