From ebad87b81bd788272703aab772123f86b4448b47 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Thu, 27 Sep 2012 13:54:40 -0700 Subject: [PATCH] Ajax load series/index --- NzbDrone.Web/Controllers/SeriesController.cs | 9 +++++++-- NzbDrone.Web/Views/Series/Index.cshtml | 8 +++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/NzbDrone.Web/Controllers/SeriesController.cs b/NzbDrone.Web/Controllers/SeriesController.cs index d82d7898f..b539b8f06 100644 --- a/NzbDrone.Web/Controllers/SeriesController.cs +++ b/NzbDrone.Web/Controllers/SeriesController.cs @@ -38,11 +38,16 @@ namespace NzbDrone.Web.Controllers } public ActionResult Index() + { + return View(); + } + + [HttpGet] + public ActionResult Series() { var series = GetSeriesModels(_seriesProvider.GetAllSeriesWithEpisodeCount()); - var serialized = new JavaScriptSerializer().Serialize(series); - return View((object)serialized); + return Json(new { aaData = series }, JsonRequestBehavior.AllowGet); } public ActionResult Edit(int seriesId) diff --git a/NzbDrone.Web/Views/Series/Index.cshtml b/NzbDrone.Web/Views/Series/Index.cshtml index 0aba91172..22b6ab23a 100644 --- a/NzbDrone.Web/Views/Series/Index.cshtml +++ b/NzbDrone.Web/Views/Series/Index.cshtml @@ -1,5 +1,4 @@ @using NzbDrone.Web.Helpers -@model string @{ViewBag.Title = "NzbDrone";} @section HeaderContent @@ -76,9 +75,7 @@ Episodes @*Commands Column*@ - - - + @@ -111,8 +108,9 @@ $('#seriesGrid').removeClass('hidden-grid'); oTable = $('.dataTablesGrid').dataTable({ + "sAjaxSource": "Series/Series", + "bServerSide": false, "bShowAll": false, - "aaData": @Html.Raw(Model), "bPaginate": false, "bLengthChange": false, "bFilter": false,