Conditional TD background formatting based on data
New DiscussionSetup:
I'm dynamically creating multiple grids on a single page based on some table definition criteria passed into the page via an MVC template.
There are common columns that are easily defined, and then there are additional column values that vary by grid. (Each grid has a unique ID value)
I add the additional columns after each main grid has been defined, then use an ajax call to get the data to populate each grid.
Here's the code that is invoked on the main page:
@using ForecastMvc.Models;
@model BuildMatricesModel
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
@ViewBag.Title
@Html.DisplayFor(x => x.Layouts)
Layouts is a list of type MatrixLayout.
MatrixLayout.cshtml is below:
@model ForecastMvc.DataLayer.MatrixLayout
As you can see, the common column definitions are setup in the Page.OnLoad event, and the event handler is setup for each grid with the unique grid index and a list of the additional column values.
Following the grid definition, I then add the additional length columns in the AddLengthColumns function and then call the GetData function to invoke the Ajax call to get the data for that particular grid.
The matrix definition is passed back to the controller with each grid that is requesting the data. That way each ajax call is self-contained.
Here is the JavaScript for the main page:
The problem I'm having is in the FormatGrid function for the dynamic columns. I've stepped through the JavaScript, and I'm finding the Oversold + dynamicColumn value and I'm finding each of the other columns where I need to change the background color, but the background color never changes.
What am I doing wrong? It's got to be something simple that I'm missing. Am I correct?
