John5766500
Posts: 0
Joined: Wed Apr 17, 2013 2:07 pm

Generate local data and display it in a list.

thanks Katya

John5766500
Posts: 0
Joined: Wed Apr 17, 2013 2:07 pm

Generate local data and display it in a list.

Quick question...(if I may) is it possible to show how to append to an existing list as oppose to creating a new one each time.

In the example above I'm getting a new list built each time I call this code. So I get "filter items" appearing multiple times under each other.

thanks

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

Generate local data and display it in a list.

Hi, you can add/delete list elements, but it's easier to delete list and create new one:

codevar data = ["Tinker", "Tailor", "Solder", "Spy"];
var listHtml = '<ul id="newList" data-role="listview">';
if ($('#newList')&#46;size() > 0) {
$('#newList')&#46;remove();
}
for(var i=0; i<data&#46;length; i++)
{
listHtml += '<li><a href="#">'+data+'<&#47;a><&#47;li>';
}
listHtml += '<&#47;ul>';
var listElement = $(listHtml);
Appery('mobilecontainer1')&#46;append(listElement);
listElement&#46;listview();/code

John5766500
Posts: 0
Joined: Wed Apr 17, 2013 2:07 pm

Generate local data and display it in a list.

Thanks Marina - Works, but the filter still spawns another. Image

John5766500
Posts: 0
Joined: Wed Apr 17, 2013 2:07 pm

Generate local data and display it in a list.

I've built the list now based on a generic service which has resolved this funny.

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

Generate local data and display it in a list.

Glad it's working :)

Return to “Issues”