Hi,
I've tested an application using desktop browsers, Ripple Emulator and the Blackberry 9800 emulator and it works perfectly. When it deploy it to the device, using listview() fails and no more Javascript is executed.
Is there a workaround for this?
Thanks for your help :)
--Adding details
When the user clicks an element of a listview, not the one giving problems, a method fills a page which was created empty from the beginning of the execution. At the end of the method the listview is created and refreshed to add the style.
Here is the HTML:
- <div id="artistDetailsPage" data-role="page">
- <div data-role="header" data-position="fixed">
- <h1 id="artistName"></h1>
- <a href="#artistPage" data-icon="arrow-l" data-iconpos="notext" data-direction="reverse">Atrás</a>
- <a onclick="$.mobile.silentScroll(0);" data-icon="arrow-u" data-iconpos="notext">Arriba</a>
- </div>
- <div data-role="content">
- <a id="artistDescription" style="color:#000000"></a>
- <br/>
- <img id="artistImage" alt="" style="width:100%;"/>
- <h2>Eventos</h2>
- <div id="artistEventList"></div>
- <h2>Sedes</h2>
- <div id="artistVenueList"></div>
- </div>
- </div>
Here is the Javascript code:
- function onArtistDetailsClick(id)
- {
- var listaEventos = '<ul id="artistEventListData" data-role="listview" data-inset="true">';
- var listaSedes = '<ul id="artistVenueListData" data-role="listview" data-inset="true">';
- for(var j = 0; j < datos["EventosArtistas"].length; j++)
- {
- if(datos["EventosArtistas"][j].ID_ARTIST == datos["Artistas"][id].ID_ARTIST)
- {
- var idEvento = obtenerIndice("Eventos", "ID_EVENT", datos["EventosArtistas"][j].ID_EVENT);
- if(datos["Eventos"][idEvento].NAME_EVENT == "")
- {
- listaEventos += '<li><a onclick="onEventDetailsClick(' + idEvento +');" data-transition="turn">' + datos["Artistas"][id].NAME + '</a></li>';
- }
- else
- {
- listaEventos += '<li><a onclick="onEventDetailsClick(' + idEvento +');" data-transition="turn">' + datos["Eventos"][idEvento].NAME_EVENT + '</a></li>';
- }
- var idSede = obtenerIndice("Sedes", "ID_VENUE", datos["Eventos"][idEvento].ID_VENUE);
- listaSedes += '<li><a onclick="onVenueDetailsClick(' + idSede +');" data-transition="turn">' + datos["Sedes"][idSede].NAME + '</a></li>';
- }
- }
- var idImagen = obtenerIndice("Imagenes", "ID_ARTIST", datos["Artistas"][id].ID_ARTIST);
- document.getElementById("artistName").innerHTML = datos["Artistas"][id].NAME;
- if(datos["Artistas"][i].LDESCRIPTION != null)
- {
- document.getElementById("artistDescription").innerHTML = datos["Artistas"][id].LDESCRIPTION;
- }
- if(idImagen != null && datos["Imagenes"][idImagen].URL != null)
- {
- document.getElementById("artistImage").setAttribute("src", 'http://ficwebblob.blob.core.windows.net' + datos["Imagenes"][idImagen].URL);
- }
- else
- {
- document.getElementById("artistImage").setAttribute("src", "");
- }
- listaEventos += "</ul>";
- listaSedes += "</ul>";
- document.getElementById("artistEventList").innerHTML = listaEventos;
- document.getElementById("artistVenueList").innerHTML = listaSedes;
- $.mobile.changePage("#artistDetailsPage", { transition: "pop"} );
- //Here the execution stops
- $("#artistEventListData").listview();
- $("#artistVenueListData").listview();
- $("#artistEventListData").listview('refresh');
- $("#artistVenueListData").listview('refresh');
- }