0



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..

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.