javascript - JQuery Mobile listview not refreshing after ajax call -
i have ajax call makes list of things json array when data loaded there no visual styling on , refresh method not working.
success: function (data, status, xhr) { value="+data.occ_filtersobj_cust[i].customername+">"+data.occ_filtersobj_cust[i].customername+"</option>"); //$("#filters").append("<optgroup id="+data.occ_filtersobj_cust[i].customertype+" label="+data.occ_filtersobj_cust[i].customertype+">"); (var i=0, len=data.occ_filtersobj_cust.length; < len; i++) { if (i > 0 && data.occ_filtersobj_cust[i].customertype===data.occ_filtersobj_cust[i-1].customertype) { //write customer types $("#filters").append("<li>"+data.occ_filtersobj_cust[i].customername+"</li>"); } else { //write customer names $("#filters").append("<li>"+data.occ_filtersobj_cust[i].customertype+"</li>"); } } $('#filters').listview('refresh'); }, complete: function (xhr, status) { $('#filters').listview('refresh'); },
as can see code try calling refresh method on success , complete , neither working.
edit: when add search filter list , type in listview refreshes it's not refreshing refresh method. , list inside collapsible if makes difference.
i don't know why, adding little delay on 'refresh' did trick me.
you can thing in ajax success callback.
settimeout(function () { $("#filters").listview("refresh"); }, 10);
Comments
Post a Comment