Kevin6209373
Posts: 0
Joined: Thu Sep 05, 2013 7:39 am

Populate menu select item from local variable array

This is the code I was executing:

var data = ["Localstorage item 1", "Localstorage item 2", "Localstorage item 3"];

var listComponent = Appery("mobileList");
$.each(data, function(index, value) {
listComponent.append(
$('a rel="nofollow"' + value + '/a')
);
});
listComponent.listView("refresh");

Kevin6209373
Posts: 0
Joined: Thu Sep 05, 2013 7:39 am

Populate menu select item from local variable array

I got the following variation on your sample code to work..

//I HAD TO MOVE WHERE THE .listview('refresh') was
// I know a single refresh at the end should work, but I couldnt get it to.

var data = ["New item 1", "New item 2", "New item 3"];

var listComponent = Appery("mobilelist_test1");
$.each(data, function(index, value) {
listComponent.append(
$('a rel="nofollow"' + value + '/a')
).listview('refresh');
});

//This refresh from your sample did not work for me:
//listComponent.listView("refresh");
//The following didnt work for me either:
//listComponent.listView('refresh');

Kirit Vaghela
Posts: 0
Joined: Tue Aug 27, 2013 11:23 am

Populate menu select item from local variable array

Hello

In my case listview has grid with columns

  1. column has static image

  2. column has two lables ( i.e title and description )

  3. column has arrow image.

    I have json data in localStorage and I also get title and description data from json data.

    Now I want to bind this title and description to list view.

    So how can I bind two data.

    Thanks

    Image

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Populate menu select item from local variable array

Hello!
1) Parse your data from localStorage - this should help https://getsatisfaction.com/apperyio/...
2) Add Item to the List with needed structure - instead pre&#46;append($('a rel="nofollow"' + value + ''))/a/pre add needed html structure to li, not just < a tag
3) Refresh the List

Kirit Vaghela
Posts: 0
Joined: Tue Aug 27, 2013 11:23 am

Populate menu select item from local variable array

Thanks Maryna
I'm getting error "TypeError listComponent.listView is not a function"
I don't understand this error.
code
var listComponent = Appery("mobilelist_2");
listComponent&#46;append('<li>'+text to append+'<&#47;li>');
listComponent&#46;listView("refresh");
/code

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Populate menu select item from local variable array

Please replace listComponent.listView("refresh"); with listComponent.listview("refresh");

Kirit Vaghela
Posts: 0
Joined: Tue Aug 27, 2013 11:23 am

Populate menu select item from local variable array

Thanks again Marya

Return to “Issues”