I’m attempting to style the ‘containing’ cell in a kendo (mvc) grid. The column is bound as follows:
@(Html.Kendo().Grid(Of RTFVM)().Name("RealTimeFinancials") _ .Columns(Sub(c) c.Bound(Function(x) x.Line.Months(0).Total).Title("Jan").ClientTemplate("#= processCell(Line.Months[0])#") etc
And my JS conditional styling function is as follows:
function processCell(CellData) { var monthNumber = CellData.MonthNumber; var output; switch(CellData.Message) { case null: output = fn(CellData.Total); break; case 'Total': output = '' + fn(CellData.Total) + ''; break; default: output = '' + CellData.Message + ''; } return output; }
Using the above I can style the text
that appears in the cell but apparently not the cell itself (I guess you could call it the text object’s ‘parent’/container).
Is there any way to access/style the cell from within the ClientTemplate or do I have to separately find the cell by using the databound event using the data-uid row/column-find method?
Try like:
Add a class/id to the output “div” that is returned from the “processCell” function and using that class get the parent element of the cell and add styling to that cell. Hope it works!