Page 2 of 2

Generate local data and display it in a list.

Posted: Fri Apr 26, 2013 6:18 am
by John5766500

thanks Katya


Generate local data and display it in a list.

Posted: Fri Apr 26, 2013 7:54 am
by John5766500

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


Generate local data and display it in a list.

Posted: Fri Apr 26, 2013 11:02 am
by Maryna Brodina

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


Generate local data and display it in a list.

Posted: Fri Apr 26, 2013 12:03 pm
by John5766500

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


Generate local data and display it in a list.

Posted: Fri Apr 26, 2013 6:51 pm
by John5766500

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


Generate local data and display it in a list.

Posted: Fri Apr 26, 2013 8:29 pm
by Kateryna Grynko

Glad it's working :)