Visualforce Page标签笔记

<apex:page >

属性:

  • title:在页面中显示的标题
  • controller:对应的后台控制器
  • tabstyle:选择对象的选项卡样式
  • sidebar: 侧边栏是否显示,默认为:true
  • showHeader:是否显示标签名称,默认为true
  • applyBodyTag:是否禁用body,默认为true
  • applyHtmlTag:是否禁用html,默认为:true
  • docType:描述文档类型:"html-4.01-strict", "xhtml-1.0-transitional", "xhtml-1.1-basic", "html-5.0",
  • standardStylesheets:是否引入自带的sf样式,默认true
<apex:form>
  • id
<apex:pageBlock>

类似于选项卡

  • title:显示的内容
  • mod:样式,默认为:detail,可选参数:detail 、maindetail 、edit 、inlineEdit
<apex:messages>

显示错误信息

<apex:pageBlockSection>

选项组

  • title : 名称
  • columns : 跨多少行
<apex:panelGrid>

HTML中对应的表格

  • columns :一行中显示的多少字段
  • id:id
 <apex:selectList >
  • multiselect:是否可以选多个,如果为true代表可以选多个,默认false
  • size:默认显示几条,默认显示全部有效数据
  • value:值
 <apex:selectOptions>
  • value:值
<apex:inputText>

输入框

< apex:actionStatus/>

用于Ajax请求

  • startText:请求之前显示的文本信息
  • stopText: 请求之后显示的文本信息
 <apex:commandButton>

类似于:

<input id="thePage:theForm:theButton" type="submit" name="thePage:theForm:theButton" value="Save" />
  • action:调用控制器的方法,如果用户权限不够,则调用失败
  • value:按钮的显示值
  • id:id
  • disabled:是否只读,默认为:false
  • status:于ajax相关联的组件

简单用法

<apex:actionStatus id="query_user_status">
                            <apex:facet name="stop">
                                <apex:commandButton value="搜索" action="{!searchUsers}" status="query_user_status" reRender="the_form"/>
                            </apex:facet>
                            <apex:facet name="start">
                                <apex:commandButton value="搜索中" disabled="true" status="query_user_status"/>
                            </apex:facet>
                        </apex:actionStatus>
 <apex:pageBlockTable>

类似于tbody标签

  • value:需要显示的集合
  • var:别名
<apex:column/>

配合<apex:pageBlockTable>标签使用,类似于td标签

  • headerValue:表头

示列

<apex:pageBlock title="My Content">
        <apex:pageBlockTable value="{!account.Contacts}" var="item">
            <apex:column value="{!item.name}"/>
            <apex:column value="{!item.phone}"/>
        </apex:pageBlockTable>
<apex:inputCheckbox/>

复选框

<apex:outputField>

类似于span的标签

  • value : 值
<apex:actionFunction/>

调用控制器的组件

  • action:调用控制器的方法
  • reRender:本地刷新重新渲染,指定一个ID
  • status:请求中,显示的状态,指定一个ID
<apex:actionPoller> 

指定时间,发送AJAX请求

列如

<apex:actionPoller action="{!incrementCounter}" reRender="counter" interval="15"/>
<apex:commandLink>

html中的a标签差不多

<apex:component/>

html中的div或者span标签差不多

<apex:flash/>

引入flash地址

 <apex:insert/>

将此组件与<apex:composition><apex:define>组件在多个页面之间共享数据

<apex:map>

展示地图

<apex:facet>

动态组件,只能写在,父组件中

<apex:composition/>

引入标签

<apex:page>
    <apex:outputText value="(template) This is before the header"/><br/>
    <apex:insert name="header"/><br/>
    <apex:outputText value="(template) This is between the header and body"/><br/>
    <apex:insert name="body"/>
</apex:page>

<apex:page>
    <apex:composition template="composition">
        <apex:define name="header">(page) This is the header of mypage</apex:define>
        <apex:define name="body">(page) This is the body of mypage</apex:define>
    </apex:composition>
</apex:page>
<apex:dataList/>

数据集合

<apex:page controller="dataListCon">
    <apex:dataList value="{!accounts}" var="account">
        <apex:outputText value="{!account.Name}"/>
    </apex:dataList>
</apex:page>

/*** Controller: ***/
public class dataListCon {

    List<Account> accounts;

    public List<Account> getAccounts() {
        if(accounts == null) accounts = [SELECT Name FROM Account LIMIT 10];
        return accounts;
    }

}
apex:dynamicComponent componentValue="{!dynamicDetail}" />

动态生成组件

/* Controller */
public class SimpleDynamicController {

    public Component.Apex.Detail getDynamicDetail() {
        Component.Apex.Detail detail = new Component.Apex.Detail();
        detail.expressions.subject = '{!acct.OwnerId}';
        detail.relatedList = false;
        detail.title = false;
        return detail;
    }

    // Just return the first Account, for example purposes only
    public Account acct {
        get { return [SELECT Id, Name, OwnerId FROM Account LIMIT 1]; }
    }
}
<apex:enhancedList><apex:ListViews  />

显示视图列表

<apex:iframe/>

类似于网页框架

<apex:tab/>

选项卡

<!-- Page: -->
<apex:page id="thePage">
    <apex:tabPanel switchType="client" selectedTab="name2" id="theTabPanel">
    <apex:tab label="One" name="name1" id="tabOne">content for tab one</apex:tab>
    <apex:tab label="Two" name="name2" id="tabTwo">content for tab two</apex:tab>
    </apex:tabPanel>
</apex:page>
    <apex:outputPanel/>

类似于span

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值