VisualForce:将参数传递给中继器内的自定义组件
我不明白为什么这不起作用:(
<apex:repeat value="{!MyContacts}" var="c" >
<c:ContactRowComponent contactLastName="{!c.LastName}"/>
</apex:repeat>
在主控制器上 MyContacts 返回一个 Contact 对象数组,在组件上 contactLastName 被定义为一个 String 属性)
这给了我错误:
文字值是
似乎是在说需要文字值而不是公式?我想做的事情是不可能的,还是我做错了?
I can't figure out why this isn't working:
<apex:repeat value="{!MyContacts}" var="c" >
<c:ContactRowComponent contactLastName="{!c.LastName}"/>
</apex:repeat>
(where on the main controller MyContacts returns an array of Contact objects, and on the component contactLastName is defined as a String attribute)
This gives me error:
Literal value is required for attribute contactLastName in <c:ContactRowComponent> at line 25 column 27
It seems to be saying that a literal value is required and not a formula? Is what I am trying to do impossible, or am I doing it wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我也遇到过这个问题。就我而言,这是因为我在组件属性中指定了默认属性,但由于某种原因,您无法在使用公式的字段上执行此操作。
例如,这将在传入公式值时产生您所描述的错误:
因此,如果删除默认属性,错误将得到解决。让我知道这是否可以解决您的特定用例。
I have come across this issue as well. In my case it was because I specified the default attribute in the component attribute which you can't do on fields that use a formula for some reason.
For instance this will produce the error you described when passing in a formula value:
So if you remove the default attribute the error will be resolved. Let me know if this solves for your particular use case.