自定义组件开发全解析
1. AllOrNothingPageBlock 自定义组件
AllOrNothingPageBlock 自定义组件接收一个通用 sObject 列表,并将其内容包装在一个输出面板中,仅当列表不为空时才会渲染该面板。以下是其代码示例:
<apex:outputPanel rendered="{!render}">
<apex:pageBlock title="{!title}">
<apex:repeat value="{!list}" var="ele">
<apex:componentBody >
<apex:variable var="{!var}" value="{!ele}"/>
</apex:componentBody>
</apex:repeat>
</apex:pageBlock>
</apex:outputPanel>
<apex:componentBody /> 定义了 Visualforce 页面内容的插入位置。由于它位于 <apex:repeat /> 组件内部,因此会为集合中的每个元素进行插入操作。Visualforce 页面通过传递列表、页面块标题和表示列表中元素的变量名等属性给组件,包含的标记可以引用该变量名来访问元素的字段或属性。示例如下:
超级会员免费看
订阅专栏 解锁全文
681

被折叠的 条评论
为什么被折叠?



