问题
I'm trying to divide a jQuery mobile list depending on an attribute in each li element.
$("#mylistview").listview({
autodividers: true,
autodividersSelector: function ( li ) {
var out = $('li').attr('attr_name');
return out;
}
});
But it creates the list divider only for the 1st list item attribute. I'm using listview(refresh) each time I insert a new li.
What I don't understand is if I need to call the function I pasted here before creating the list, after or for each element. I think I've tried each of those but maybe I'm not doing it right.
Is that because the 1.2.0 is still alpha? I thought this function was working now http://jquerymobile.com/test/docs/lists/docs-lists.html
Thanks to whoever will be able/willing to answer.
回答1:
My fault: the right code is
$("#mylistview").listview({
autodividers: true,
autodividersSelector: function ( li ) {
var out = li.attr('attr_name'); //HERE THE CHANGE
return out;
}
});
Thanks anyway for the reply.
来源:https://stackoverflow.com/questions/12693706/jquery-mobile-1-2-0-alpha-1-autodividersselector