EpisodeGrid sorting is done in the controller instead of the View, because it actually works...

pull/4/head
Mark McDowall 13 years ago
parent ceec420035
commit b9e9bb06a4

@ -93,7 +93,7 @@ namespace NzbDrone.Web.Controllers
{ {
using (MiniProfiler.StepStatic("Controller")) using (MiniProfiler.StepStatic("Controller"))
{ {
var episodes = GetEpisodeModels(_episodeProvider.GetEpisodesBySeason(seriesId, seasonNumber)); var episodes = GetEpisodeModels(_episodeProvider.GetEpisodesBySeason(seriesId, seasonNumber)).OrderByDescending(e => e.EpisodeNumber);
return View(new GridModel(episodes)); return View(new GridModel(episodes));
} }
} }

@ -126,18 +126,12 @@
.Width(80); .Width(80);
}) })
.DetailView(detailView => detailView.ClientTemplate("<div><#= Overview #> </br><#= Path #> </div>")) .DetailView(detailView => detailView.ClientTemplate("<div><#= Overview #> </br><#= Path #> </div>"))
.Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber).Descending()).Enabled(false)) //.Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber).Descending()).Enabled(false))
.Footer(true) .Footer(true)
.DataBinding( .DataBinding(
d => d =>
d.Ajax().Select("_AjaxSeasonGrid", "Series", d.Ajax().Select("_AjaxSeasonGrid", "Series",
new RouteValueDictionary { { "seriesId", Model.SeriesId }, { "seasonNumber", season } })) new RouteValueDictionary { { "seriesId", Model.SeriesId }, { "seasonNumber", season } }))
@*.ToolBar(toolbar => toolbar.Template(@<text>
<ul class="sub-menu">
<li><a href="../Episode/SearchSeason?seriesId=@seriesId&seasonNumber=@season" onclick="searchSeason('@seriesId', @season); return false;">Search for Season</a></li>
<li><a href="../Episode/RenameSeason?seriesId=@seriesId&seasonNumber=@season" onclick="renameSeason('@seriesId', @season); return false;">Rename Season</a></li>
</ul>
</text>))*@
.ClientEvents(clientEvents => .ClientEvents(clientEvents =>
{ {
clientEvents.OnRowDataBound("grid_rowBound"); clientEvents.OnRowDataBound("grid_rowBound");

Loading…
Cancel
Save