Fieldsets - APEX & Visualforce
Fieldsets:
A field set is a grouping of fields. Using fieldsets you can use the dynamic bindings to the visualforce page. Generally, in the scenario where we need to show the list of fields in the visualforce page and in future if the we need to add one or more field in the visualforce page, we need to add the code to display those fields in the page. But using fieldsets, the complexity is reduced. We can add the fields to fieldsets to show it in the visualforce page.
So the below example, the visualforce page retrieves the list of opportunity based on the Account. In APEX & Visualforce page, the fieldsets are used to retrieve the fields.
A new fieldset named "Opportunity_RelatedList" is created and following fields are added to it.
A field set is a grouping of fields. Using fieldsets you can use the dynamic bindings to the visualforce page. Generally, in the scenario where we need to show the list of fields in the visualforce page and in future if the we need to add one or more field in the visualforce page, we need to add the code to display those fields in the page. But using fieldsets, the complexity is reduced. We can add the fields to fieldsets to show it in the visualforce page.
So the below example, the visualforce page retrieves the list of opportunity based on the Account. In APEX & Visualforce page, the fieldsets are used to retrieve the fields.
A new fieldset named "Opportunity_RelatedList" is created and following fields are added to it.
- Opportunity Name
- Account Name
- Stage
- Closed Date
The fieldset class has following properties to access through APEX:
Comments
Post a Comment