+ Start a Discussion
IT Admin DeloitteIT Admin Deloitte 

Rendered in a Visualforce Page

Hi All,

in my VF page i've got a table. I would like to show only certain values and, since it is a VF, i can set rendered.
My problem is that, using rendered, the VF correctly hide the record but also leave the corresponding row empy. Looking at the picture, I would like that the first 3 rows disappear.
 

User-added image 

Thankyou!

 

Best Answer chosen by IT Admin Deloitte
Vipul TaylorVipul Taylor
The reason you are getting this is because you are setting the rendered tag to your data but not to the rows that are still getting rendered. I am assuming you are using <table>, <tr> and <td> tags.

If you want only a subset of data - I would recommend that you update the variable that you are using (List / Set / Map) with the appropriate subset of the data and then display this subset variable rather than using the rendered tag. This way you will ensure that the data is displayed correctly, Also the page wont have to load the entire data set.

All Answers

Ronan O'Neill 6Ronan O'Neill 6
I have the same problem, but haven't really had a chance to try solve it. 

I was thinking maybe creating an object to pass just the records you want to display or possibly sorting the data in such a way you can just display the top ones. 

Would like a better solution though, I think being able to skip a record in an iteration would be very useful.

 
Vipul TaylorVipul Taylor
The reason you are getting this is because you are setting the rendered tag to your data but not to the rows that are still getting rendered. I am assuming you are using <table>, <tr> and <td> tags.

If you want only a subset of data - I would recommend that you update the variable that you are using (List / Set / Map) with the appropriate subset of the data and then display this subset variable rather than using the rendered tag. This way you will ensure that the data is displayed correctly, Also the page wont have to load the entire data set.
This was selected as the best answer
IT Admin DeloitteIT Admin Deloitte
It was actually simpler modify the Controller than the VF.

Thankyou all.