Lars Soligard
Posts: 0
Joined: Tue Sep 16, 2014 5:31 pm

Map objects to list

Hi again :)

I have a localStorageDB layer over localStorage. When i query this "db", objects are returned. Now i would really like to map these objects to a list. So far i have used:

var result = JSON.stringify(object);
Apperyio('labelName').text(result);

...Just to see that the data is being stored and that i can read the data on a different page.

But this doesn't look very nice. Could you please point me in the right direction?

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

Map objects to list

Hello Lars,

[quote:]But this doesn't look very nice.[/quote]
Could you please show a screenshot of what you get and explain what you want to achieve?

Lars Soligard
Posts: 0
Joined: Tue Sep 16, 2014 5:31 pm

Map objects to list

Yes of course! As usual, thank you for the quick reply!

This is what it looks like:

Image

This is what i want to achieve. So in some way i need to be able to do what is normally done in the mapping, I guess? This screen is listing results from an actual database:

Image

Hope it makes sense ;-)

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Map objects to list

Hi Lars,

Yes it makes sens :)

Here is an a example solution for you:

1 Create generic service http://prntscr.com/434glf/direct.

2 Click "Add custom implementation"

3 Choose "new javascript" with name "genericService1JS". http://prntscr.com/434h6f/direct

4 Use following code in "JS" implementation:

pre

//Note replace "genericService1JS" with your value.
Appery.genericService1JS = Appery.createClass(null, {

Code: Select all

 init : function(requestOptions) { 
     this.__requestOptions = $.extend({}, requestOptions); 
 }, 

 process : function(settings) { 
         //Note: you need replace "yourLSV" with LSV that's stores your array. 
         var responseData = JSON.parse(localStorage.getItem("yourLSV")); 

         console.log("responseData"); 
         //Take a look on browser console to see what is stored in your LSV. 
         console.log(responseData); 

         settings.success(responseData ); 

         settings.complete('success'); 
 } 

});

/pre

After these steps you can use this service in mapping to populate your list.

Regards.

Lars Soligard
Posts: 0
Joined: Tue Sep 16, 2014 5:31 pm

Map objects to list

Thank's for your reply! This looks very promising. I suspected that generic service vas involved. In browser console i get this error:

"ReferenceError: Appery is not defined"

Any idea why? I've changed the name of "yourLSV" to match the name of my LSV.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Map objects to list

Hi Lars,

Please try to replace "Appery" with "Apperyio" in given code.

Regard.

Lars Soligard
Posts: 0
Joined: Tue Sep 16, 2014 5:31 pm

Map objects to list

Thank's for the quick response! I get the same error: "ReferenceError: Apperyio is not defined"

Apperyio.genericService1JS = Apperyio.createClass(null, {
init : function(requestOptions) {
this.__requestOptions = $.extend({}, requestOptions);
},
process : function(settings) {
var responseData = JSON.parse(localStorage.getItem("fav"));
console.log("responseData");
console.log(responseData);
settings.success(responseData );
settings.complete('success');
}
});

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Map objects to list

Hi Lars,

Please give us your app public link, and describe steps how we can reproduce this problem.

We will take a look.

Thanks & regards.

Lars Soligard
Posts: 0
Joined: Tue Sep 16, 2014 5:31 pm

Map objects to list

link sendt to support, also with link to this conversation.

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

Map objects to list

Hi Lars,

Thank you! We would also appreciate if you tell how to reproduce it step by step.

Return to “Issues”