Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

storage models and array

Hi,
I have a question about the structure of a storage model and arrays
I have a service the returns all properties in a collection on a where using user login.
It all works fine but I want to speed us the app by loading this returned service in localstorage and then map from there as needed

Because I dont know how many properties are present, do I need to save all returned data to one array or would it be an array of arrays

if you have an example screenshot of the model structure it would be a great help
here is a screenshot of the mapping as it is now.

thanks alot, I really like this feature cheers!
Image

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

storage models and array

Hello Michael,

There should be an array of objects with properties, not an array of arrays.

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

storage models and array

Hi Evgene,
this is great!
I implemented the above and it has made this part of the app really fast, no waiting for service, when panel opens data is already present as it was mapped from local storage on pageshow.

I wonder if the next is poss?
now that the favourite properties are in localstorage, how could I map the required property from the same localstorage when I click the more button?

here is a screenshot
really love this feature,
thanks!

Image

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

storage models and array

Michael,

1 Create a generic service
2 Add the parameters in response tab
3 Map data on event success from local storage in the required elements on the page
4 When you click on the appropriate button, call this service

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

storage models and array

Cheers Evegene,
I dont see how this method would pull the correct property, there may be one property or five properties,

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

storage models and array

Hi Michael,

In mapping you can click JS button and add a JavaScript code to filter data as needed.

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

storage models and array

Hi Kateryna,
thanks for that,
I have saved the property _id to local storage and mapped my previous lsv to a grid on a panel when run all properties are listed,
so have you an example of the js I need to get the property _id from localstorage and print only this properties details

thanks very much,
Everything is so much quicker.
Best upgrade by far!

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

storage models and array

Hello Michael,

There are 2 options
1) Create a generic service. In this service you can receive data from local storage. Parse them (JSON.parse), make a search on parsed data and return only the data that meet the search conditions.
2) Create a regular service which takes data from local storage and in mapping add js code to hide don't need data. It's easier to do. Here I will explain
Let's say you have this respons - screenshot 1
You want to make a filter on a field n of response. The value by which you should filter is stored in local storage variable nFilter.
Create the mapping - screenshot 2
Add js code in the mapping - screenshot 3
Results ot the test - screenshot 4

Image

Image

Image

Image

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

storage models and array

Hi Evegene
I have implemented the following
on login all properties in collection favs with this login are saved to local storage

created a model for favprop_id in local storage.

on login complete favprop_id is populated with all property ids in a array as following screenshot

Image

I deleted one of the ids manually to test, and added the js to the mapping from localStorage from which is of the more button

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

storage models and array

Hi Evegene
I have implemented the following

on login all properties in collection favs with this login are saved to local storage

Image

created a model for favprop_id in local storage.
on login complete favprop_id is populated with all property ids in a array as following screenshot

Image

I deleted one of the ids manually to test, and added the js to the mapping from localStorage to test

Image

Image

the result is error Error: c15r: component not found
unsure if this is my implementation or an upgrade problem as I am getting the error in another app also (since yesterdays upgrade)

Image

Return to “Issues”