Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
255
Conditional formatting of cells based upon data in a separate column
posted

I'm trying to conditionally format the data in one cell, based upon the value of data in another cell. I hooked into the pagerRendered event in the paging feature as discussed in this post: http://www.infragistics.com/community/forums/t/86886.aspx which worked, but the user didn't want paging to interfere with the display.  I'm looking for another event that works in the same way, but I'm struggling getting things going. 

I tried using the following code but grid.rows().length is always 0;

$(document).delegate("#transactionsDataGrid", "iggriddatabound", function (evt, ui) {
    var grid = ui.owner.grid;
    if (grid == null) return;
    for (var i = 0; i < grid.rows().length; i++) {
        var dateType = grid.getCellValue(i, "DateType");
        var reqDateColumnIndex = $("#" + grid.id() + "_" + "requestDate").data("columnIndex");
        if (dateType.toUpperCase() == "REQUESTED") {
            $(grid.cellAt(reqDateColumnIndex - 1, i)).css('color', 'red');
        }
    }
});

Is there another event I can hook into?

  • 5513
    Offline posted

    Hello Kenneth,

    While hooking to an event and changing the rendered cells' style in this way is a feasible approach I would suggest trying templating first as a more elegant and performant solution. I prepared a small sample for your reference.

    I hope this helps! Thank you for using Infragistics forums!

    Best regards,

    Stamen Stoychev

    templating.zip