Clearling a List with jQuery Mobile - layout issue
Hello there.
I got the simple following function that will populate a DIV element with a list
- function populate() {
- var turma = Persistencia.getTurma();
- var ct = turma.alunos.length;
- $("#listaAlunosChamados").remove(); //removes the UL if exists (i tested w/o it)
- $('#alunosChamados').html('<ul data-role="listview" id="listaAlunosChamados" class="listaAlunosChamados" data-inset="true">'); // creates the UL into the DIV #alunosChamados
- while(ct--) { // fills the list
- var aluno = turma.alunos[ct];
- if(aluno.presente) {
- $("#listaAlunosChamados").append("<li id='alunoChamado' class='alunoChamado'><img src='img/ok.gif' class='ui-li-icon'/>"+aluno.nome+"</li>");
- } else {
- $("#listaAlunosChamados").append("<li id='alunoChamado' class='alunoChamado'><img src='img/x.gif' class='ui-li-icon'/>"+aluno.nome+"</li>");
- }
- }
- $('#alunosChamados').append("</ul>"); // close the list
- window.location = "app.html#chamadaFeita";
- };
The first time i run this, it goes nicely. After that, the layout gets really buggy, and its displayng like a common list not like an jQuery Mobile list. Does anyone what can be happening ?
Thanks alot for the attention !