white.devils
white.devils

Reputation: 131

trigger create jquery mobile

i have a problem, i have this code

<ul id="lista" data-role="listview"  data-theme="b" data-inset="true">
            <li data-role="list-divider">Players</li>

and this script

    $('#home').live('pageinit',function(){
      $.getJSON("prendivalori.php",function(result){
          var nome = result[1].NOME;
          var overall = result[1].OVERALL;
          $('#lista').append('<li data-corners="false" data-count-theme="f" data-icon="arrow-r" data-theme="c" class="ui-btn ui-li-has-count"><a href="#valori"  class="ui-link-inherit data-transition="pop"><h1>'+nome+'</h1><p id="squadra" class= "ui-li-desc" ></p><span id= "" class="ui-li-count ui-btn-corner-all"><font id="number">'+overall+'</font></span></a><span class="ui-icon ui-icon-arrow-r"></span></li>').trigger('create');
          });

});

but when the page load the listview doesn't look with mobile style can anyone help me?

Upvotes: 0

Views: 2437

Answers (1)

Jack
Jack

Reputation: 11003

The .trigger("create") method is meant to initialize the widgets on your page, in this case you listview has already been initialized and what you want to do is refresh it (in reality this should probablly really be included in the .trigger("create") method) .

In order to refresh a listview you should use the listview's refresh method

For example

 $('#lista').listview('refresh');

Upvotes: 2

Related Questions