jquery - JQM grouping by category -
hei. grouping works fine exept when tried add together category items count. after adding this, items stop grouping according category. there way prepare it?
http://jsfiddle.net/smatisen/md17azga/
$('.todo-listview').on("afterrefresh", function () { $(".ui-li-divider").each(function () { console.log($(this).text()); var textsplit = $(this).text().split(",_#_"); var countvalue = textsplit[1]; console.log(countvalue); $(this).text(textsplit[0]); var count = document.createelement('span'); $(count).addclass('ui-li-count').text(countvalue); $(this).append(count); }); }); $('.todo-listview').listview({ autodividers: true, autodividersselector: function (li) { var out = li.data("category"); var ranomnumber = $('li[data-category="' + out + '"]').size(); if (out == "") { homecoming "a table not set"; } else { homecoming [out, "_#_" + ranomnumber]; } } }).listview("refresh").trigger("afterrefresh");
you can utilize .length instead of .size() count, , instead of returning array, concatenate string (return out + "_#_" + ranomnumber;
)
$('.todo-listview').listview({ autodividers: true, autodividersselector: function (li) { var out = li.data("category"); var ranomnumber = $('li[data-category="' + out + '"]').length; if (out == "") { homecoming "a table not set"; } else { homecoming out + "_#_" + ranomnumber; } } }).listview("refresh").trigger("afterrefresh");
updated fiddle
jquery listview jquery-mobile
No comments:
Post a Comment