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
224
Row and Column highlighting
posted

Is there a way to highlight a specific row or column?

When highlighting a row, I'd like to highlight it depending on a cell value. For instance if there is a 'colour' column, I'd like to show the entire row in that colour.

When highlighting a column, I'd like to highlight it when a filter is set. It is difficult to see when a filter is set, so to make it more clear to the user, I'd like to highlight the entire column.

cheers.

  • 2225
    posted

    We're doing something like this as well.

    I don't know if this will fit your requirements, but one way of doing this is by using Row Templating. With it you can apply conditional styles to the row based upon a field value.

    A tutorial by Taz Abdeali can be found here:

    http://blogs.infragistics.com/blogs/taz_abdeali/archive/2011/04/21/jquery-templating-tips-amp-tricks.aspx

     

  • 24671
    posted

    Hi,

    Here is one possible solution:

    $("#yourGrid").bind({

    mousemove: function (e) {

    var row = $(e.target).closest("tr");

    // check criteria

    row.children().addClass("my special class");

    },

    mouseout: function (e) {

    // find the TR again, and remove the classes from the cells ,  if applied

    }

    });

  • 19693
    posted

    Hello jbergenthal ,

    Thank you for posting in our forum.

    You can iterate through the rows and cells of the igGrid and checking if the value is equal to the criteria

     

    function on_Click() {

                var criteria = $('#criteria').val();

                $("#grid1").igGrid('rows').each(function (index) {

                    var row = $("#grid1").igGrid("rowAt", index);

     

                    $(row.cells).each(function (i) {

                        var cell = $("#grid1").igGrid('cellAt', i, index);

                        var cellText = $(cell).text();

     

                        if (cellText == criteria) {

                            $(cell).css("color", "#FF0000");

                            $(row).css("background-color", "#FF0000");                    

                        }

                    });

                });

            }

      <input type="text" id="criteria" />

     

      <input type="button" value="Color a cell" id="button1" onclick="on_Click();" />

    For more information regarding the styling please refer to the below article

    http://help.infragistics.com/NetAdvantage/jQuery/Current/CLR4.0?page=igGrid_Styling_and_Theming.html

    You can see the CSS classes regarding the filtering

    http://help.infragistics.com/jQuery/2011.1/ui.iggridfiltering#!theming

    Let us know if you need further assistance.