+ Start a Discussion
Rohit PaulRohit Paul 

How to apply HTML Style Color for each row of PageBlockTable?

Hi All,

 

I am preparing a view where the user can select the name and get all the details on the page.

 

I require to present a General Overview table where i display some amounts to collect.

This amount can be negetive or positive.....

 

For that I require to add color to each row depending on the amount.

Amount <= 0 - Green

Amount >0 - Red

 

Please refer to the following image for the pageBlockTable layout of th VF page:

 

Layout of the page

 

Can this be done in VisualForce?

Please assist.

 

EIE50EIE50

Hi,

 

Yes you can achive what you are after using java script (if else) in combination with css in your Vf page.

 

In between i would like a parcel of biriyani :).

 

Thanks.

Rohit PaulRohit Paul

Sure I'll send you the Biryani    ;), but can you give me an example on how I can achieve this along with the VisualForce Tags.

I am pretty new to this sphere.............................. :)

Rehan DawtRehan Dawt

Hi,

There is one attribute in pageBlockTable called "rowClasses" you can make use of this.

Define

 

<style>
.red {background-color : red}
.green {background-color : green}
</style>

<apex:pageBlockTable rowclasses="red,green">
<apex:column value="{}" />
</pageBlockTable>

You can make use of this.