You need to sign in to do that
Don't have an account?
pavan kumar 1156
VF page ListController(Please Explain why)
1<apex:page standardController="Account" recordSetVar="accounts" tabstyle="account" sidebar="false">
2 <apex:pageBlock >
3 <apex:pageBlockTable value="{!accounts}" var="a">
4 <apex:column value="{!a.name}"/>
5 </apex:pageBlockTable>
6 </apex:pageBlock>
7</apex:page>
in above example recordset variable sets varible with name accounts and agian why we have create a new variable with the name "a"?
can any on explain please
2 <apex:pageBlock >
3 <apex:pageBlockTable value="{!accounts}" var="a">
4 <apex:column value="{!a.name}"/>
5 </apex:pageBlockTable>
6 </apex:pageBlock>
7</apex:page>
in above example recordset variable sets varible with name accounts and agian why we have create a new variable with the name "a"?
can any on explain please
Here in,
recordSetVar="accounts"
we are assigning a variable to standard controller Account so that we can use it easily instead of writing Account everywhere, generally we use any small length variable but it does the same function.
For,
<apex:pageBlockTable value="{!accounts}" var="a">
we are iterating over all accounts i.e. as in Loops, we need a temperory variable to iterate.
Similarly, we are using "a" over here.
Please mark it as best if you find it helpful.
Thanks
Ajay
All Answers
In the above code, you are iterating over all the accounts using standard controller.
So, while iterating over those accounts you will require a variable i.e "a" here.
But
e.g. if you go for creating accounts from the page by taking name as input then you would not require another variable "a". you can use recordsetvar.
Thanks
Ajay
recordSetVar="accounts" Here what is accounts having?
and what about this <apex:pageBlockTable value="{!accounts}" var="a"> ??
Here in,
recordSetVar="accounts"
we are assigning a variable to standard controller Account so that we can use it easily instead of writing Account everywhere, generally we use any small length variable but it does the same function.
For,
<apex:pageBlockTable value="{!accounts}" var="a">
we are iterating over all accounts i.e. as in Loops, we need a temperory variable to iterate.
Similarly, we are using "a" over here.
Please mark it as best if you find it helpful.
Thanks
Ajay