Grid colouring for ignored and missing.

This commit is contained in:
Mark McDowall 2012-01-29 22:14:46 -08:00
parent 2635ff9bee
commit 78f7b8a53c
5 changed files with 46 additions and 1 deletions

View File

@ -268,3 +268,14 @@ button span, input[type="button"] span, input[type="submit"] span, input[type="r
color: rgb(169, 169, 169); color: rgb(169, 169, 169);
padding: 4px; padding: 4px;
} }
/* Episode Grid Row Colouring */
.episodeIgnored
{
background-color: #F2F5A9;
}
.episodeMissing
{
background-color: #F5A9A9;
}

View File

@ -1,4 +1,23 @@
function grid_onError(e) { function grid_onError(e) {
//Suppress the alert //Suppress the alert
e.preventDefault(); e.preventDefault();
}
//Highlight rows based on a number of details
function highlightRow(e) {
var row = e.row;
var dataItem = e.dataItem;
var ignored = dataItem.Ignored;
var status = dataItem.Status;
if (ignored) {
$(row).addClass('episodeIgnored');
return;
}
if (status == "Missing") {
$(row).addClass('episodeMissing');
return;
}
} }

View File

@ -106,6 +106,7 @@ function toggleMasters(seasonNumber, ignored) {
//Functions called by the Telerik Season Grid //Functions called by the Telerik Season Grid
function grid_rowBound(e) { function grid_rowBound(e) {
var dataItem = e.dataItem; var dataItem = e.dataItem;
var row = e.row;
var ignored = dataItem.Ignored; var ignored = dataItem.Ignored;
var episodeId = dataItem.EpisodeId; var episodeId = dataItem.EpisodeId;
@ -122,6 +123,8 @@ function grid_rowBound(e) {
if (seriesId == 0) if (seriesId == 0)
seriesId = dataItem.SeriesId; seriesId = dataItem.SeriesId;
highlightRow(e);
} }
function grid_dataBound(e) { function grid_dataBound(e) {

View File

@ -8,7 +8,7 @@
@Html.IncludeCss("Grid.css") @Html.IncludeCss("Grid.css")
} }
@{ ViewBag.Title = Model.Title; } @{ ViewBag.Title = Model.Title; }
<style> <style>
.seasonToggleTopGroup .seasonToggleTopGroup
{ {
overflow: hidden; overflow: hidden;

View File

@ -46,6 +46,7 @@
.Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.AirDateTime).Ascending()).Enabled(true)) .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.AirDateTime).Ascending()).Enabled(true))
.ClientEvents(clientEvents => .ClientEvents(clientEvents =>
{ {
clientEvents.OnRowDataBound("grid_rowBound");
if (EnviromentProvider.IsProduction) if (EnviromentProvider.IsProduction)
clientEvents.OnError("grid_onError"); clientEvents.OnError("grid_onError");
}) })
@ -86,6 +87,7 @@
.Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.AirDateTime).Ascending()).Enabled(true)) .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.AirDateTime).Ascending()).Enabled(true))
.ClientEvents(clientEvents => .ClientEvents(clientEvents =>
{ {
clientEvents.OnRowDataBound("grid_rowBound");
if (EnviromentProvider.IsProduction) if (EnviromentProvider.IsProduction)
clientEvents.OnError("grid_onError"); clientEvents.OnError("grid_onError");
}) })
@ -128,6 +130,7 @@
.Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.AirDateTime).Ascending()).Enabled(true)) .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.AirDateTime).Ascending()).Enabled(true))
.ClientEvents(clientEvents => .ClientEvents(clientEvents =>
{ {
clientEvents.OnRowDataBound("grid_rowBound");
if (EnviromentProvider.IsProduction) if (EnviromentProvider.IsProduction)
clientEvents.OnError("grid_onError"); clientEvents.OnError("grid_onError");
}) })
@ -169,9 +172,18 @@
.Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.AirDateTime).Ascending()).Enabled(true)) .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.AirDateTime).Ascending()).Enabled(true))
.ClientEvents(clientEvents => .ClientEvents(clientEvents =>
{ {
clientEvents.OnRowDataBound("grid_rowBound");
if (EnviromentProvider.IsProduction) if (EnviromentProvider.IsProduction)
clientEvents.OnError("grid_onError"); clientEvents.OnError("grid_onError");
}) })
.Render();} .Render();}
</div> </div>
</div> </div>
@section Scripts{
<script type="text/javascript">
function grid_rowBound(e) {
highlightRow(e);
}
</script>
}