diff --git a/StockManMVC/Controllers/LocationsController.cs b/StockManMVC/Controllers/LocationsController.cs index 4d1d9c7..85f0739 100644 --- a/StockManMVC/Controllers/LocationsController.cs +++ b/StockManMVC/Controllers/LocationsController.cs @@ -42,10 +42,10 @@ namespace StockManMVC.Controllers if (LocTypeID == null) LocTypeID = ""; if (SearchVal == null) SearchVal = ""; if (SortOrd == null) SortOrd = ""; - //if (page == null) page = 1; - //if (pageSize == null) pageSize = 5; - int PageSize = 5; - int PageNum = (page ?? 1); + if (page == null) page = 1; + if (pageSize == null) pageSize = 5; + //int PageSize = 5; + //int PageNum = (page ?? 1); ViewBag.LocTypeID = LocTypeID; ViewBag.SearchVal = SearchVal; @@ -78,9 +78,9 @@ namespace StockManMVC.Controllers } ViewBag.LocTypeID = LocTypeID; return PartialView("_ListByType", CurrLocations.ToList()); - //return PartialView("_ListByType", CurrLocations.ToPagedList(PageNum, PageSize)); + //return PartialView("_ListByType", CurrLocations.ToPagedList((int)page, (int)pageSize)); } - + // GET: Locations/Create (mode=std|full, opzionale) public ActionResult Create(string mode) { diff --git a/StockManMVC/Views/Locations/Index.cshtml b/StockManMVC/Views/Locations/Index.cshtml index af2f79e..edd0399 100644 --- a/StockManMVC/Views/Locations/Index.cshtml +++ b/StockManMVC/Views/Locations/Index.cshtml @@ -1,6 +1,4 @@ @model IEnumerable -@*@model PagedList.IPagedList*@ -@using PagedList.Mvc; @{ ViewBag.Title = "Configurazione Posizioni"; @@ -13,7 +11,6 @@
Configurazione Posizioni - @Html.Hidden("SortOrd")
@Html.DropDownList("LocTypeDD", null, "-- TUTTI --", htmlAttributes: new { @class = "form-control" }) @@ -28,10 +25,8 @@
- @Html.Action("ListByType", new { LocTypeID = @ViewBag.LocTypeID }) -
- @*@Html.PagedListPager(Model, page => Url.Action("Index", new { page, sortOrder = ViewBag.SortOrd, currentFilter = ViewBag.CurrentFilter }))*@ - pag @Html.TextBox("page") / @Html.TextBox("pageSize") +
+ @Html.Action("ListByType", new { LocTypeID = @ViewBag.LocTypeID, page = ViewBag.page, pageSize = ViewBag.pageSize })
@@ -48,13 +43,11 @@ function refreshSelectedData() { var LocTypeID = $("#LocTypeDD").val(); var SearchVal = $("#SearchVal").val(); - var SortOrd = $("#SortOrd").val(); - var page = $("#page").val(); - var pageSize = $("#pageSize").val(); - $("#mainDiv").load('@(Url.Action("ListByType", "Locations", null, Request.Url.Scheme))?LocTypeID=' + LocTypeID + '&SearchVal=' + SearchVal + '&SortOrd=' + SortOrd + '&page=' + page + '&pageSize=' + pageSize); - + var queryUrl = 'LocTypeID=' + LocTypeID + '&SearchVal=' + SearchVal + '&SortOrd=@ViewBag.SortOrd&page=@ViewBag.page&pageSize=@ViewBag.pageSize'; + // ricarico + $("#mainDivGrid").load('@(Url.Action("ListByType", "Locations", null, Request.Url.Scheme))?' + queryUrl); // modifico URL! - history.replaceState('LocTypeID=' + LocTypeID, 'Locations', '?LocTypeID=' + LocTypeID + '&SearchVal=' + SearchVal + '&SortOrd=' + SortOrd + '&page=' + page + '&pageSize=' + pageSize) + history.replaceState('LocTypeID=' + LocTypeID, 'Locations', '?' + queryUrl) } $(document).ready(function () { $("#LocTypeDD").change(function () { @@ -63,9 +56,6 @@ $("#SearchVal").change(function () { refreshSelectedData(); }); - $("#SortOrd").change(function () { - refreshSelectedData(); - }); }); function LoadCreateNew() { diff --git a/StockManMVC/Views/Locations/_ListByType.cshtml b/StockManMVC/Views/Locations/_ListByType.cshtml index af3bb84..6a8dfa8 100644 --- a/StockManMVC/Views/Locations/_ListByType.cshtml +++ b/StockManMVC/Views/Locations/_ListByType.cshtml @@ -30,4 +30,9 @@ } - \ No newline at end of file + + +
+ @*@Html.PagedListPager(Model, page => Url.Action("Index", new { page, SearchVal = ViewBag.SearchVal, SortOrd = ViewBag.SortOrd, currentFilter = ViewBag.CurrentFilter }))*@ + @Html.TextBox("page") / @Html.TextBox("pageSize") +
\ No newline at end of file diff --git a/StockManMVC/bin/StockManMVC.dll b/StockManMVC/bin/StockManMVC.dll index ccc2d35..dac198b 100644 Binary files a/StockManMVC/bin/StockManMVC.dll and b/StockManMVC/bin/StockManMVC.dll differ