Style cell in the Kendo grid via ClientTemplate

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") _
                  c.Bound(Function(x) x.Line.Months(0).Total).Title("Jan").ClientTemplate("#= processCell(Line.Months[0])#")

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!

Hello, buddy!责编内容来自:Hello, buddy! (源链) | 更多关于

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 前端开发 » Style cell in the Kendo grid via ClientTemplate

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录