028_Visualforce Components 案例整理

1.主要介绍outputPanel 、rendered  

outputPanel :组合在一起的一组内容,使用HTML <span>标签,<table>,<div>标签或两者都呈现。 使用<apex:outputPanel>将组件组合在一起以进行AJAX刷新。

该组件使用“html-”前缀支持HTML传递属性。 传递属性附加到生成的容器标签<div>或<span>,具体取决于layout属性的值。

<apex:outputPanel id="acc_" rendered="{!!inquiry.isNewc}">
 <table>
      <span class="btn_" id="select_" onclick="beforeNew();">新增</span>
 </table>
</apex:outputPanel>

代码解读:在这个输出面板中,当{!!inquiry.isNewc}  为True时,才会呈现(显示)以下table。点击新增调用JS方法。

 

<apex:page standardController="Account" recordSetvar="accounts">
<apex:pageBlock title="Viewing Accounts">
<apex:form id="theForm">
<apex:panelGrid columns="2">
<apex:outputLabel value="View:"/>
<apex:selectList value="{!filterId}" size="1">
<apex:actionSupport event="onchange" rerender="list"/>
<apex:selectOptions value="{!listviewoptions}"/>
</apex:selectList>
</apex:panelGrid>
<apex:pageBlockSection >
<apex:dataList var="a" value="{!accounts}" id="list">
{!a.name}
</apex:dataList>
</apex:pageBlockSection>
</apex:form>

 

这部分代码是直接Copy PDF中的内容,认为selectList 中的写法非常好,值得大家学习以下,是直接获取当前Object中View数据;并且能通过Event直接显示(重新呈现 Rerender)对应的view中的List;

<apex:outputtext value="{0,number,#,##0.000}"> 如果是小数的话,相当于格式化

集合:< apex:selectCheckBoxes >,< apex:selectRadio >, or< apex:selectList >.< apex:selectOptions >为子集

 

posted @ 2017-09-12 15:23  BandariFang  阅读(595)  评论(0编辑  收藏  举报