2012-12-13 45 views

回答

0

你必須通過JavaScript一些Ajax調用程序,以顯示新行,然後用這段JavaScript代碼:

$(window).scroll(function() { 
    if (document.documentElement.clientHeight + $(document).scrollTop() >= document.body.offsetHeight) { 
     getCities(10); 
    } 
}); 

這裏有一個示例方法:

function getCities(count) { 
    $.getJSON("@Url.Action("GetCities")", { term: $("#search").val(), start: $("#cities tbody tr").length, count: count }, function (data, status, req) { 
     if (data.count != 0) { 
      $.each(data.cities, function() { 
       $("#cities tbody").append("<tr data-id='" + cityid + "' data-state='" + stateid + "'><td>" + name + "</td><td>" + state + "</td></tr>"); 
      }); 
     } 
    }); 
}