بله با کلیک روی صفحات 2 و 3 و .. به صفحات دیگه پیجر میرود (به صورت Ajax ی) و پیجر به درستی کار میکند فقط Tooltip ها در صفحه باقی میمانند :
ویدیو کامل تر
یک نمونه رو ساده از کد هاش :
کد View :
@using MvcPaging
@model WebShopping2017.Models.ViewModels.Product.SearchPr o_ViewModel
@{
ViewBag.Title = "SearchCat";
Layout = "~/Views/Shared/Layout/_AdminLayout.cshtml";
}
@using (Ajax.BeginForm("Index", "Product",
new AjaxOptions { UpdateTargetId = "grid-list", HttpMethod = "Post", LoadingElementId = "loading", OnBegin = "beginPaging", OnSuccess = "successPaging", OnFailure = "failurePaging" },
new { id = "frm-search" }))
{
<div id="grid-list" class="container-fluid">
@{ Html.RenderPartial("_AjaxEmployeeList", Model); }
</div>
}
@section Scripts{
<script>
$(function () {
$('a').tooltip();
});
function beginPaging(args) {
// Animate
$('#grid-list').fadeOut('normal');
}
function successPaging() {
// Animate
$('#grid-list').fadeIn('normal');
$('a').tooltip('hide');
}
function failurePaging() {
alert("Could not retrieve list.");
}
</script>
}
کد پارشیال ویو AjaxEmployeeList_ که در هر بار درخواست فراخوانی میشود :
@using MvcPaging
@model WebShopping2017.Models.ViewModels.Product.SearchPr o_ViewModel
<table class="table table-bordered table-hover">
<thead>
<tr>
<th>
ID
</th>
<th>
Name
</th>
<th>
Email
</th>
<th>
Phone
</th>
<th>
City
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.Products)
{
<tr>
<td>
@item.Id
</td>
<td>
@item.Title
</td>
<td>
@item.PrimaryPrice
</td>
<td>
@item.ExistCount
</td>
<td>
@item.TotalPriceSales
</td>
</tr>
}
</tbody>
</table>
<div class="container">
@Html.Raw(Ajax.Pager(
new Options
{
PageSize = Model.PageSize,
TotalItemCount = Model.TotalItemCount,
CurrentPage = Model.CurrentPage,
ItemTexts = new ItemTexts() { Next = "Next", Previous = "Previous", Page = "P" },
ItemIcon = new ItemIcon() { First = "icon-backward", Previous = "icon-chevron-left", Next = "icon-chevron-right", Last = "icon-forward" },
TooltipTitles = new TooltipTitles() { Next = "Next page", Previous = "Previous page", Page = "Page {0}." },
Size = Size.normal,
Alignment = Alignment.centered,
IsShowControls = true,
IsShowFirstLast = true,
//CssClass = ""
},
new AjaxOptions
{
UpdateTargetId = "grid-list",
OnBegin = "beginPaging",
OnSuccess = "successPaging",
OnFailure = "failurePaging"
}, new { controller = "Product", action = "Index", CatName = ViewData["CatName"] }))
<div class="well">
شروع از محصول شماره <span class="badge badge-success">@Model.ItemStart</span> تا محصول <span class="badge badge-success">@Model.ItemEnd</span>
و تعدا کل یافته ها : <span class="badge badge-info">@Model.TotalItemCount</span>
</div>
</div>