You need to sign in to do that
Don't have an account?

Reg: How to render the pageblock table...
i'm having the pageblock table with one empty row having null values in it.. Now i want to render this table ,only if there is values in the table. How to achieve this? How to render the table when there is value in the list? If there is blank value in the list, then the table should not be rendered. i'm not able to render that by using rendered="{!list.size()!=0), as i'm having the empty row in the table and the list size is 1 already.
So, you mean to say that list always has one row (which will be something like default). Then based on some query/conditions, you'll be adding records to that list.
In that case, you may use a flag, which would be true only if your query/conditions return you atleast a result. If it doesn't, you can set it to false. And render the list only if that flag is true.
Something like:
List<wrapperClass> lstTemp = new List<wrapperClass>();
Boolean hasRecords = false; // flag you may use
..
..
this list now has one default row (empty).
You must be querying some data somewhere,
for(Account a : [Select Name From Account Where Id in : setTemp])
{
// here when you get some data, set that flag to TRUE.
hasRecords = true;
}
On your page,
<apex:pageBlockTable value="{!lstWrapper}" var="w" rendered="{!hasRecords}">
Hope this helps.
All Answers
What kind of list is this?
BTW FYI, this rendered="{!list.size()!=0) shouldn't work anyway.
On visualforce, you don't have to use those paranthesis. IT should be :
rendered="{!list.size > 0}"
hi that list is the sobject type.. yes i ahve used as rendered="{!list.size > 0}" only.. but it is not working as i'm having one empty row already with empty values..
So, you mean to say that list always has one row (which will be something like default). Then based on some query/conditions, you'll be adding records to that list.
In that case, you may use a flag, which would be true only if your query/conditions return you atleast a result. If it doesn't, you can set it to false. And render the list only if that flag is true.
Something like:
List<wrapperClass> lstTemp = new List<wrapperClass>();
Boolean hasRecords = false; // flag you may use
..
..
this list now has one default row (empty).
You must be querying some data somewhere,
for(Account a : [Select Name From Account Where Id in : setTemp])
{
// here when you get some data, set that flag to TRUE.
hasRecords = true;
}
On your page,
<apex:pageBlockTable value="{!lstWrapper}" var="w" rendered="{!hasRecords}">
Hope this helps.
thanks a lot.. it helped