I\'m a bit out of my depth here and I\'m hoping this is actually possible.
I\'d like to be able to call a function that would sort all the items in my list alphabeti
I was looking to do this myself, and I wasnt satisfied with any of the answers provided simply because, I believe, they are quadratic time, and I need to do this on lists hundreds of items long.
I ended up extending jquery, and my solution uses jquery, but could easily be modified to use straight javascript.
I only access each item twice, and perform one linearithmic sort, so this should, I think, work out to be a lot faster on large datasets, though I freely confess I could be mistaken there:
sortList: function() {
if (!this.is("ul") || !this.length)
return
else {
var getData = function(ul) {
var lis = ul.find('li'),
liData = {
liTexts : []
};
for(var i = 0; i" + obj[sortedTexts[i]].html+"";
}
return htmlStr;
};
this.html(processData(getData(this)));
}
}