ok x reset paginazione a cambio filtraggi!!!

This commit is contained in:
Samuele E. Locatelli
2016-10-21 10:50:04 +02:00
parent f00495be96
commit 615d2e9302
4 changed files with 6 additions and 3 deletions
@@ -21,11 +21,13 @@ namespace StockManMVC.Controllers
// GET: Locations/LocTypeID
public ActionResult Index(string LocTypeID, string SearchVal, string SortOrd, int? page, int? pageSize)
{
// fix campi nulli
if (LocTypeID == null) LocTypeID = "";
if (SearchVal == null) SearchVal = "";
if (SortOrd == null) SortOrd = "";
if (page == null) page = 1;
if (pageSize == null) pageSize = 5;
// salvo in model valori
ViewBag.LocTypeDD = new SelectList(db.LocType, "ID", "Descr", LocTypeID);
ViewBag.LocTypeID = LocTypeID;
ViewBag.SearchVal = SearchVal;
+2 -1
View File
@@ -43,7 +43,7 @@
function refreshSelectedData() {
var LocTypeID = $("#LocTypeDD").val();
var SearchVal = $("#SearchVal").val();
var queryUrl = 'LocTypeID=' + LocTypeID + '&SearchVal=' + SearchVal + '&SortOrd=@ViewBag.SortOrd&page=@ViewBag.page&pageSize=@ViewBag.pageSize';
var queryUrl = 'LocTypeID=' + LocTypeID + '&SearchVal=' + SearchVal + '&SortOrd=@ViewBag.SortOrd&page=1&pageSize=@ViewBag.pageSize'; //riporto a pag 1 in caso di cambio filtro!
// ricarico
$("#mainDivGrid").load('@(Url.Action("ListByType", "Locations", null, Request.Url.Scheme))?' + queryUrl);
// modifico URL!
@@ -54,6 +54,7 @@
refreshSelectedData();
});
$("#SearchVal").change(function () {
// riporto a pag 1...
refreshSelectedData();
});
});
@@ -8,11 +8,11 @@
<tr>
<th>
@*Html.DisplayNameFor(model => model.Descr).ToString(),*@
@Html.ActionLink("Descrizione", "Index", new { LocTypeID = ViewBag.LocTypeID, SearchVal = ViewBag.SearchVal, SortOrd = ViewBag.DescrSortParm })
@Html.ActionLink("Descrizione", "Index", new { LocTypeID = ViewBag.LocTypeID, SearchVal = ViewBag.SearchVal, SortOrd = ViewBag.DescrSortParm, page = 1 })
</th>
<th>
@*Html.DisplayNameFor(model => model.LocType.Descr).ToString()*@
@Html.ActionLink("Tipo", "Index", new { LocTypeID = ViewBag.LocTypeID, SearchVal = ViewBag.SearchVal, SortOrd = ViewBag.LocTypeSortParm })
@Html.ActionLink("Tipo", "Index", new { LocTypeID = ViewBag.LocTypeID, SearchVal = ViewBag.SearchVal, SortOrd = ViewBag.LocTypeSortParm, page = 1 })
</th>
<th></th>
</tr>
Binary file not shown.