ajax navigation to page with dynamic listview

ajax navigation to page with dynamic listview

Hi

I would need some help on the follwing scenario:

I have a page which calls a second page (no multipage template). On this second page I have a listview which is dynamically populated (from a webservice call).

  1.  function loadSPTasks()
     {    
          $.getJSON('/SIGProto/_vti_bin/listdata.svc/Aufgaben', function(data) {
               $.each(data.d.results, function(i, result) {
                     html = "<li><a href=\"" + result.Pfad + "/DispForm.aspx?ID=" + result.ID + "\" data-                        ajax=\"false\"><h2>" + result.Titel + "</h2></a></li>";
                    $("#searchList").append(html);
                });





  2.          $("#searchList").listview("refresh");
         }); 
  3. }

 

I am currently calling this function from the pageinit event

  1. $(document).bind("pageinit", function()
    {
       loadSPTasks();  

  2.  });

If I call this page with a "full" http request (data-ajax="false") - everything works well. If I call the page with an ajax transition from the first page the rendering fails with a error

cannot call methods on listview prior to initialization; attempted to call method 'refresh'

I also tried calling SP Tasks in the pageshown event, but with the same error. Can anyone give me a hint how to do this?