안녕하세요 MVC에서 아약스 사용하여 mvccontrib 표 새로 고치려고하고 있지만 작동하지 않습니다. "return PartialView ("myview ", mylist)를 사용할 때" 아무 일도 없었어. 응답은 jquery 코드에 결코 도달하지 않았습니다. 나는 debbuger라는 키워드를 사용하여 작동하는지 알아 보았지만 거기에는 도달하지 못했습니다.MVCContrib 새로 고침 JQuery 아약스
이 그리드 새로 내 JQuery와 코드입니다 :
function refreshTable() {
$.ajaxSetup({
async: false,
cache: false
});
$.get('<%= Url.Action("RefreshGridData", "Countries") %>',
function (response) {
debugger;
$(".table-list").replaceWith(response)
});
}
을 그리고 이것은 내 지침 :
public ActionResult RefreshGridData()
{
GetAllCountries();//this puts a list in the ViewData
return PartialView("CountriesPage", (List<iCatalogData.Country>)ViewData["CountriesList"]);
}
그리고 이것은 내 그리드입니다 :
<div id="container">
<% Html.Grid((List<iCatalogData.Country>)ViewData["CountriesList"])
.Columns(column =>
{
column.For(co => Html.ActionLink(co.IdCountry.ToString(), "EditCountry", "Countries", new { id = co.IdCountry }, null)).Named("Id Country");
column.For(co => co.CountryName);
column.For(co => Html.ActionLink("Delete", "DeleteCountry", "Countries", new { id = co.IdCountry }, null)).Named("Delete");
}).Attributes(id => "example", @class => "table-list", style => "width: 100%;").Empty("No countries available").Render();
%>
</div>
감사합니다.
이제 요청은 okey이지만 그리드가 렌더링되면 mvccontrib의 모든 기능이 사라지고 스타일, 검색, 페이징 등이 잘못되었습니다. 무엇을 잘못하고 있습니까? – Sebastian
$ ('. table-list'). replaceWith (...) 대신 $ ('# container'). replaceWith (...)를 사용해야합니다. –