0

I am displaying a PageBlockTable with 12 records from a Custom object. And each <apex:column> has its own color code rendered based on the value.

<apex:column headerValue="Field One" width="4%"
             styleClass="{!CASE(a.Field1__c, 'Red', 'red', 'Green', 'green', 'Yellow', 'yellow', 'white')}">
    <apex:outputText >{!a.Field1__c}</apex:outputText>
</apex:column>

But, when my mouse pointer hover on any of the rows, it disables all the colors and show a plain white row. But, I want the row to stay how it rendered(different color codes to each table data). Is there any Boolean variable I need to make false or other attributes to add/change?

5
  • 1
    This is more of a CSS question than a VF question, I think Commented Sep 11, 2017 at 23:20
  • I see this: <tr class="dataRow even first highlight ..... when I mouse hover on any of the rows. It changes dynamically. How can I get a hold of it? How to make it not to switch between highlight and non-highlight?
    – SatyaV
    Commented Sep 11, 2017 at 23:25
  • You can't change the default SFDC stylesheets... but you can override them. Ergo, a CSS issue. :) Commented Sep 11, 2017 at 23:26
  • Seems simple, but as this highlight keeps on changing dynamically on my mouse movement, I cannot inspect the right attribute. :(
    – SatyaV
    Commented Sep 11, 2017 at 23:36
  • Use the Chrome console to add it manually Commented Sep 12, 2017 at 0:23

1 Answer 1

6

You can't "disable" it, but apparently you can countermand it. I've come up with two potential solutions.

!important

Use an important style.

<style>
.red, .red.highlight {
    background: red !important;
}
</style>

This will override the Salesforce style sheet.

Toggle "highlight"

You can also remove the class as its added:

<apex:pageBlockTable onrowmouseover="this.classList.remove('highlight')" ...

onRowMouseOver is called after the library does its stuff, and so you'll undo the highlight that it does. There's no noticeable flicker because browsers delay rendering until the end of a JavaScript execution cycle.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .