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
70
How can i change Row Style on mouseover
posted

I have a requirement where i need ot change the Row style on mouseover please help in addition MouseOutHandler never gets fired for soem reason

part of my displayLayout has following tag to catch these 2 events and below is the  Javascript code woth the functions

<ClientSideEvents

MouseOverHandler="uwgFixedAsset_MouseOverHandler"

MouseOutHandler="uwgFixedAsset_MouseOutHandler">

</ClientSideEvents>

<script type="text/javascript" language="javascript"><!--function uwgFixedAsset_MouseOverHandler(gridName, id, objectType)

{

// Check if the object type is a cell

if (objectType == 0)

{

// Get the cell that has the checkbox image

var checkBoxCell = igtbl_getCellById(id);

// Get the cell that has the check state value

var thisRow = checkBoxCell.getRow();

// Change style

 

thisRow.style.backgroundColor = 'LightYellow';

}

}

function uwgFixedAsset_MouseOutHandler(gridName, id, objectType)

{

// Check if the object type is a cell

if (objectType == 0)

{

// Get the cell that has the checkbox image

var oCell = igtbl_getCellById(id);

 

// Get the cell that has the check state value

var thisRow = checkBoxCell.getRow();

// Change style

thisRow.style.backgroundColor = 'Blue';

}

}

--></script>

  • 480
    posted

    I've tested here and I think that I know how to solve your problem....

     

    you're probably setting the grid DisplayLayout.RowStyleDefault.BackColor = anyValue.

     

    When you do that, the grid inserts the formatting in the cells.....and when you change the row background by javascript, the cells <td> overlaps the row <tr> colors....

     

    To solve that :

    1 - You can set the row background color in a css class, setting the property in the display layout mergeStyles to false. That will not applie the style in the cell, just in the row...

    2 - You can not set the value of  DisplayLayout.RowStyleDefault.BackColor and that is it....

    3 - you can change each cell of the row in your function... 

  • 480
    posted
    just one thing, you're setting the wrong property....the right is:

    thisRow.Element.style.backgroundColor = "Blue"

     maybe it's it...