fix paginazione locations!!!

This commit is contained in:
Samuele E. Locatelli
2016-10-21 11:49:05 +02:00
parent 615d2e9302
commit 78bcb6196b
7 changed files with 32 additions and 12 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ namespace StockManMVC
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/font-awesome.css",
"~/Content/PagedList.css",
//"~/Content/PagedList.css",
"~/Content/themes/base/*.css",
//"~/Content/jquery.bootgrid.css",
"~/Content/site.css"));
+3
View File
@@ -50,6 +50,9 @@ textarea {
/*z-index: 0; // commentare quando in prod?!?*/
color: #696969;
}
.pagination {
margin: 5px 0;
}
/*------------------------------------------------------------------
[ Shortcuts / .shortcuts ]
*/
+4 -1
View File
@@ -61,7 +61,10 @@ textarea {
/*z-index: 0; // commentare quando in prod?!?*/
color: #696969;
}
.pagination
{
margin: 5px 0;
}
/*------------------------------------------------------------------
[ Shortcuts / .shortcuts ]
*/
+1 -1
View File
@@ -1 +1 @@
body{padding-top:50px;padding-bottom:20px;}.body-content{padding-left:15px;padding-right:15px;}.dl-horizontal dt{white-space:normal;}input,select,textarea{max-width:280px;}.deleted{text-decoration:line-through;}.padZL{padding-left:.2em;}.padZR{padding-right:.2em;}.padZRL{padding-left:.2em;padding-right:.2em;}.colAlt{color:#c93;}.fontBig{font-size:2em;}.tNote{color:#8a8a8a;font-style:italic;}.tNoWrap{white-space:nowrap;}.navbar{min-height:0;color:#696969;}.shortcuts{text-align:center;}.shortcuts .shortcut{min-width:180px;min-height:100px;display:inline-block;padding:13.33333333px 0;margin:0 2px 1em;vertical-align:top;text-decoration:none;background:#f3f3f3;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fff),to(#eee));background-image:-webkit-linear-gradient(top,#fff,0%,#eee,100%);background-image:-moz-linear-gradient(top,#fff 0%,#eee 100%);background-image:linear-gradient(to bottom,#fff 0%,#eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffeeeeee',GradientType=0);border:1px solid #ddd;box-sizing:border-box;border-radius:10px;}.shortcuts .shortcut-sm{min-width:90px;min-height:60px;display:inline-block;padding:5px 0;margin:0 2px 1em;vertical-align:top;text-decoration:none;background:#f3f3f3;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fff),to(#eee));background-image:-webkit-linear-gradient(top,#fff,0%,#eee,100%);background-image:-moz-linear-gradient(top,#fff 0%,#eee 100%);background-image:linear-gradient(to bottom,#fff 0%,#eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffeeeeee',GradientType=0);border:1px solid #ddd;box-sizing:border-box;border-radius:10px;}.shortcuts .shortcut .shortcut-icon{width:100%;margin-top:0;margin-bottom:0;font-size:40px;color:#333;}.shortcuts .shortcut-sm .shortcut-icon{width:100%;margin-top:0;margin-bottom:0;font-size:40px;color:#333;}.shortcuts .shortcut:hover{background:#e8e8e8;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fafafa),to(#e1e1e1));background-image:-webkit-linear-gradient(top,#fafafa,0%,#e1e1e1,100%);background-image:-moz-linear-gradient(top,#fafafa 0%,#e1e1e1 100%);background-image:linear-gradient(to bottom,#fafafa 0%,#e1e1e1 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffafafa',endColorstr='#ffe1e1e1',GradientType=0);}.shortcuts .shortcut-sm:hover{background:#e8e8e8;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fafafa),to(#e1e1e1));background-image:-webkit-linear-gradient(top,#fafafa,0%,#e1e1e1,100%);background-image:-moz-linear-gradient(top,#fafafa 0%,#e1e1e1 100%);background-image:linear-gradient(to bottom,#fafafa 0%,#e1e1e1 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffafafa',endColorstr='#ffe1e1e1',GradientType=0);}.shortcuts .shortcut:active{box-shadow:inset 0 3px 5px rgba(0,0,0,.125);}.shortcuts .shortcut-sm:active{box-shadow:inset 0 3px 5px rgba(0,0,0,.125);}.shortcuts .shortcut:hover .shortcut-icon{color:#c93;}.shortcuts .shortcut-sm:hover .shortcut-icon{color:#666;}.shortcuts .shortcut-label{display:block;margin-top:.75em;font-weight:400;color:#666;}
body{padding-top:50px;padding-bottom:20px;}.body-content{padding-left:15px;padding-right:15px;}.dl-horizontal dt{white-space:normal;}input,select,textarea{max-width:280px;}.deleted{text-decoration:line-through;}.padZL{padding-left:.2em;}.padZR{padding-right:.2em;}.padZRL{padding-left:.2em;padding-right:.2em;}.colAlt{color:#c93;}.fontBig{font-size:2em;}.tNote{color:#8a8a8a;font-style:italic;}.tNoWrap{white-space:nowrap;}.navbar{min-height:0;color:#696969;}.pagination{margin:5px 0;}.shortcuts{text-align:center;}.shortcuts .shortcut{min-width:180px;min-height:100px;display:inline-block;padding:13.33333333px 0;margin:0 2px 1em;vertical-align:top;text-decoration:none;background:#f3f3f3;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fff),to(#eee));background-image:-webkit-linear-gradient(top,#fff,0%,#eee,100%);background-image:-moz-linear-gradient(top,#fff 0%,#eee 100%);background-image:linear-gradient(to bottom,#fff 0%,#eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffeeeeee',GradientType=0);border:1px solid #ddd;box-sizing:border-box;border-radius:10px;}.shortcuts .shortcut-sm{min-width:90px;min-height:60px;display:inline-block;padding:5px 0;margin:0 2px 1em;vertical-align:top;text-decoration:none;background:#f3f3f3;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fff),to(#eee));background-image:-webkit-linear-gradient(top,#fff,0%,#eee,100%);background-image:-moz-linear-gradient(top,#fff 0%,#eee 100%);background-image:linear-gradient(to bottom,#fff 0%,#eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffeeeeee',GradientType=0);border:1px solid #ddd;box-sizing:border-box;border-radius:10px;}.shortcuts .shortcut .shortcut-icon{width:100%;margin-top:0;margin-bottom:0;font-size:40px;color:#333;}.shortcuts .shortcut-sm .shortcut-icon{width:100%;margin-top:0;margin-bottom:0;font-size:40px;color:#333;}.shortcuts .shortcut:hover{background:#e8e8e8;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fafafa),to(#e1e1e1));background-image:-webkit-linear-gradient(top,#fafafa,0%,#e1e1e1,100%);background-image:-moz-linear-gradient(top,#fafafa 0%,#e1e1e1 100%);background-image:linear-gradient(to bottom,#fafafa 0%,#e1e1e1 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffafafa',endColorstr='#ffe1e1e1',GradientType=0);}.shortcuts .shortcut-sm:hover{background:#e8e8e8;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fafafa),to(#e1e1e1));background-image:-webkit-linear-gradient(top,#fafafa,0%,#e1e1e1,100%);background-image:-moz-linear-gradient(top,#fafafa 0%,#e1e1e1 100%);background-image:linear-gradient(to bottom,#fafafa 0%,#e1e1e1 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffafafa',endColorstr='#ffe1e1e1',GradientType=0);}.shortcuts .shortcut:active{box-shadow:inset 0 3px 5px rgba(0,0,0,.125);}.shortcuts .shortcut-sm:active{box-shadow:inset 0 3px 5px rgba(0,0,0,.125);}.shortcuts .shortcut:hover .shortcut-icon{color:#c93;}.shortcuts .shortcut-sm:hover .shortcut-icon{color:#666;}.shortcuts .shortcut-label{display:block;margin-top:.75em;font-weight:400;color:#666;}
@@ -26,7 +26,7 @@ namespace StockManMVC.Controllers
if (SearchVal == null) SearchVal = "";
if (SortOrd == null) SortOrd = "";
if (page == null) page = 1;
if (pageSize == null) pageSize = 5;
if (pageSize == null) pageSize = 10;
// salvo in model valori
ViewBag.LocTypeDD = new SelectList(db.LocType, "ID", "Descr", LocTypeID);
ViewBag.LocTypeID = LocTypeID;
@@ -46,19 +46,22 @@ namespace StockManMVC.Controllers
if (SortOrd == null) SortOrd = "";
//int PageNum = (page ?? 1);
if (page == null) page = 1;
if (pageSize == null) pageSize = 5;
if (pageSize == null) pageSize = 10;
ViewBag.LocTypeID = LocTypeID;
ViewBag.SearchVal = SearchVal;
ViewBag.SortOrd = SortOrd;
ViewBag.DescrSortParm = String.IsNullOrEmpty(SortOrd) ? "Descr_desc" : "";
ViewBag.LocTypeSortParm = SortOrd == "LocType" ? "LocType_desc" : "LocType";
// gestione selettore dim pagina
var pageOptions = new[] { "5", "10", "15", "25", "50", "100" };
ViewBag.PageSizeDD = new SelectList(pageOptions, pageSize.ToString());
var CurrLocations = db.Location.Where(s => s.ID != "");
if (LocTypeID.ToString() != "")
{
CurrLocations = db.Location.Where(s => s.LocTypeID == LocTypeID);
}
if(SearchVal != "")
if (SearchVal != "")
{
CurrLocations = CurrLocations.Where(s => s.Descr.Contains(SearchVal)); // || s.LocType.Descr.Contains(SearchVal)
}
+17 -6
View File
@@ -39,13 +39,24 @@
</div>
<div class="row">
@*<div class="col-sm-2">
Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) of @Model.PageCount |
</div>*@
<div class="col-sm-10">
<div class="col-sm-11">
@Html.PagedListPager(Model, page => Url.Action("Index", new { LocTypeID = ViewBag.LocTypeID, SearchVal = ViewBag.SearchVal, SortOrd = ViewBag.SortOrd, page }))
</div>
<div class="col-sm-2">
pg size @Html.TextBox("pageSize")
<div class="col-sm-1 text-right pagination">
@Html.DropDownList("PageSizeDD", null, htmlAttributes: new { @class = "form-control" })
</div>
</div>
<script type="text/javascript">
function refreshPageSize() {
var PageSizeNew = $("#PageSizeDD").val();
var queryUrl = 'LocTypeID=@ViewBag.LocTypeID&SearchVal=@ViewBag.SearchVal&SortOrd=@ViewBag.SortOrd&page=1&pageSize=' + PageSizeNew; //riporto a pag 1 in caso di cambio filtro!
// ricarico
window.location.href = 'Locations?' + queryUrl;
}
$(document).ready(function () {
$("#PageSizeDD").change(function () {
refreshPageSize();
});
});
</script>
Binary file not shown.