Reputation: 2913
Got a small issue here I cannot seem to figure out,
I programmaticaly add items to my listview from a textfile. this all is going well except for one thing, the divider is adding the same dividers again.
Here is my JQUERY (in my document ready):
var ContactList = 'data/contactlist.txt';
$.get(ContactList, function(data) {
var lines = data.split(",");
var content = "";
$.each(lines, function(n, elem) {
if(elem != "" && elem!=null)
{
content += "<li><a href='#contactPopup' data-rel='popup'>" + elem + "</a></li>";
//alert(elem);
}
});
$("#myContactList").append(content).listview("refresh");
});
wich gives me: https://drive.google.com/file/d/0Bxw7EGXkfUrKSjhtT1RsaERSNGs/edit?usp=sharing
As you can see, Divider "A" has been added twice, its creating a new divider for each person..
Upvotes: 0
Views: 57
Reputation: 24738
The autodivider feature really only works on sorted lists. So as you add new contacts you need to keep the entire list in alphabetical order.
Either insert the new li in the correct place instead of at the end, or recreate the whole list from some sorted data object/array each time.
Upvotes: 1