EnhanceWithin() is not working

眉间皱痕 提交于 2019-12-22 11:36:02

问题


am trying to populate a list view via ajax and jquery. after i have populated the data. the enhancement doesnt show.

this is what i did. Fiddle Result

var poss_ans = "6,4,8,2";
var possibleAnswers = poss_ans.split(","); //poss_ans is string containing all the answer from the database

$(document).on("pagecreate", "#page1", function () {

    var $posans = $('#poss_ans');    
    for (var i = 0; i < possibleAnswers.length; i++) {
        var label = possibleAnswers[i];
        $radio = $('<li />', {
            id: 'rad' + i,

            text: possibleAnswers[i],
        });
        var $label = ' <li ><a href="#" class="rem">   <h2>Dynamic</h2><p><b>To Peter Griffin</b><p>Ah, Mr. Griffin, Im not quite sure how to say this. Kim Bassinger? Bass singer? Bassinger?</p></a></li>';

        $posans.append($label);
    }     
        $posans.enhanceWithin().closest("fieldset").controlgroup("refresh");

});

now in the result pane(inside my fiddle) are two different results. the first result labeled " Static".is what i want to acheive when i receive the data. and the second to the last one is what am getting instead. when i inspect the element in the browser there is a new class(ui-link) that is been added to the . i tried to remove it but its not working.

i dont know why the enhanceWithin() is not working. could some please help me out.


回答1:


Just change the last line to

$posans.listview("refresh");

API DOC: http://api.jquerymobile.com/listview/#method-refresh

Updated FIDDLE



来源:https://stackoverflow.com/questions/30218192/enhancewithin-is-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!