在Salesforce VF上面指定定制的html 属性

Setting Custom HTML Attributes on Visualforce Components


我们在做成VF的时候,很多的时候需要用到Juqery的选择器来选去对象,有的时候,因为某些原因,我们需要对 <apex'inputText>等控件进行动态的id设定,但是因为Salesforce的ID不支持动态设定的原因,我们就需要用到自定义的html属性方法

它的语法结构是以 html-开头,所有用html- 写的属性,salesforce都会认为你是自定义的html属性,可以允许你编译通过,它编译完生成的实际的属性名是去掉 [ html-]关键字的
例如:
<apex:inputText html-data-id="row_{!s.rowindex}" value="{!valxx}" />

他生成的html以后,会变成
<input type="text"  data-id="row_1" value="OK" />

我们就可以利用jquery的selector语法来动态选取对象了
salesforce的custom html attributes 支持下列组件

Pass-through attributes are supported by the following  Visualforce  components.
  • <apex:column>
  • <apex:commandButton>
  • <apex:commandLink>
  • <apex:component>
  • <apex:dataTable>
  • <apex:form>
  • <apex:iframe>
  • <apex:image>
  • <apex:includeScript>
  • <apex:input>
  • <apex:inputCheckbox>
  • <apex:inputField>
  • <apex:inputHidden>
  • <apex:inputSecret>
  • <apex:inputText>
  • <apex:inputTextarea>
  • <apex:messages>
  • <apex:outputField>
  • <apex:outputLabel>
  • <apex:outputLink>
  • <apex:outputPanel>
  • <apex:outputText>
  • <apex:page>
  • <apex:pageBlock>
  • <apex:pageBlockButtons>
  • <apex:pageBlockSection>
  • <apex:pageBlockSectionItem>
  • <apex:pageBlockTable>
  • <apex:panelBar>
  • <apex:panelBarItem>
  • <apex:panelGrid>
  • <apex:sectionHeader>
  • <apex:selectCheckboxes>
  • <apex:selectList>
  • <apex:selectOption>
  • <apex:selectOptions>
  • <apex:selectRadio>
  • <apex:stylesheet>
  • <apex:tab>
  • <apex:tabPanel>

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值