Ultrawebgrid: Highlight row on MouseOver

By , 05/13/2009 2:15 PM

To highlight row in Infragistics Ultrawebgrid on mouse over event you just need to follow 4 simple steps:

First, define a class to be used for highlighting, for example:

<style type=”text/css”>.over { BACKGROUND-COLOR: lightcyan }</style>

Second, set mouse over/out handler (either in source or thru designer):

<ClientSideEvents MouseOutHandler=”MouseOutHandler” MouseOverHandler=”MouseOverHandler” />

Third, implement event handlers:

/* highlight row on mouse over */
function
MouseOverHandler(gridName, id, objectType){
     var
ohRow = igtbl_getRowById(id)
      if (ohRow) ohRow.Element.className =
“over”
}

/* return row backcolor on mouse out */
function
MouseOutHandler(gridName, id, objectType){
     var
ohRow = igtbl_getRowById(id)
      if (ohRow) ohRow.Element.className =
“”
}

Fourth (and this is important, see why) set background of the row style to inherit:

<RowStyleDefault BackColor=”Window” BorderColor=”Silver”
     
 BorderStyle=”Solid” BorderWidth=”1px”
       
CustomRules=”background-color:inherit” Cursor=”Default”> …

Now you’re all set! The row will be highlighted on mouse over.

2 Responses to “Ultrawebgrid: Highlight row on MouseOver”

  1. Ted Black says:

    This works great, except CustomRules=”background-color:inherit” needs to be in the CellStyle element not RowStyleDefault

  2. Yuriy says:

    @Ted Black
    Worked for me with RowStyleDefault :) Tested it in Infragistics 6.3 CLR2 (where it creates inline style based on RowStyleDefault for each rendered TD tag as well as in Infragistics 9.1 CLR35 (where it creates a single global style for all TR tags).
    Not sure why you would need apply it to individual CellStyle… What version of Infragistics are you using? Can you check the rendered HTML?

Leave a Reply

Panorama Theme by Themocracy