completato fix sorting (oltre a filtro + ricerca) --> manca solo paginazione!
This commit is contained in:
@@ -22,7 +22,7 @@ namespace StockManMVC.Controllers
|
||||
if (SortOrd == null) SortOrd = "";
|
||||
ViewBag.LocTypeID = new SelectList(db.LocType, "ID", "Descr", LocTypeID);
|
||||
ViewBag.LocTypeSel = LocTypeID;
|
||||
ViewBag.SearchString = SearchVal;
|
||||
ViewBag.SearchVal = SearchVal;
|
||||
var location = db.Location.Include(l => l.LocType);
|
||||
return View(location.ToList());
|
||||
}
|
||||
@@ -34,6 +34,8 @@ namespace StockManMVC.Controllers
|
||||
if (LocTypeID == null) LocTypeID = "";
|
||||
if (SearchVal == null) SearchVal = "";
|
||||
if (SortOrd == null) SortOrd = "";
|
||||
ViewBag.LocTypeSel = LocTypeID;
|
||||
ViewBag.SearchVal = SearchVal;
|
||||
ViewBag.DescrSortParm = String.IsNullOrEmpty(SortOrd) ? "Descr_desc" : "";
|
||||
ViewBag.LocTypeSortParm = SortOrd == "LocType" ? "LocType_desc" : "LocType";
|
||||
var CurrLocations = db.Location.Where(s => s.ID != "");
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-2">
|
||||
<strong>Configurazione Posizioni</strong>
|
||||
@Html.Hidden("SortOrd")
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
@Html.DropDownList("LocTypeID", null, "-- TUTTI --", htmlAttributes: new { @class = "form-control" })
|
||||
@@ -41,10 +42,11 @@
|
||||
function refreshSelectedData() {
|
||||
var LocTypeID = $("#LocTypeID").val();
|
||||
var SearchVal = $("#SearchVal").val();
|
||||
$("#mainDiv").load('@(Url.Action("ListByType", "Locations", null, Request.Url.Scheme))?LocTypeID=' + LocTypeID + '&SearchVal=' + SearchVal);
|
||||
var SortOrd = $("#SortOrd").val();
|
||||
$("#mainDiv").load('@(Url.Action("ListByType", "Locations", null, Request.Url.Scheme))?LocTypeID=' + LocTypeID + '&SearchVal=' + SearchVal + '&SortOrd=' + SortOrd);
|
||||
|
||||
// modifico URL!
|
||||
history.replaceState('LocTypeID=' + LocTypeID, 'Locations', '?LocTypeID=' + LocTypeID + '&SearchVal=' + SearchVal)
|
||||
history.replaceState('LocTypeID=' + LocTypeID, 'Locations', '?LocTypeID=' + LocTypeID + '&SearchVal=' + SearchVal + '&SortOrd=' + SortOrd)
|
||||
}
|
||||
$(document).ready(function () {
|
||||
$("#LocTypeID").change(function () {
|
||||
@@ -53,6 +55,9 @@
|
||||
$("#SearchVal").change(function () {
|
||||
refreshSelectedData();
|
||||
});
|
||||
$("#SortOrd").change(function () {
|
||||
refreshSelectedData();
|
||||
});
|
||||
});
|
||||
|
||||
function LoadCreateNew() {
|
||||
|
||||
@@ -3,12 +3,10 @@
|
||||
<table class="table table-condensed table-responsive table-striped table-hover table-bordered">
|
||||
<tr>
|
||||
<th>
|
||||
@*@Html.DisplayNameFor(model => model.Descr)*@
|
||||
@Html.ActionLink(Html.DisplayNameFor(model => model.Descr).ToString(), "Index", new { SortOrd = ViewBag.DescrSortParm })
|
||||
@Html.ActionLink(Html.DisplayNameFor(model => model.Descr).ToString(), "Index", new { LocTypeID = ViewBag.LocTypeSel, SearchVal = ViewBag.SearchVal, SortOrd = ViewBag.DescrSortParm })
|
||||
</th>
|
||||
<th>
|
||||
@*@Html.DisplayNameFor(model => model.LocType.Descr)*@
|
||||
@Html.ActionLink(Html.DisplayNameFor(model => model.LocType.Descr).ToString(), "Index", new { SortOrd = ViewBag.LocTypeSortParm })
|
||||
@Html.ActionLink(Html.DisplayNameFor(model => model.LocType.Descr).ToString(), "Index", new { LocTypeID = ViewBag.LocTypeSel, SearchVal = ViewBag.SearchVal, SortOrd = ViewBag.LocTypeSortParm })
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user