从控制器更改 APEX 标签属性?
我想知道是否可以从控制器更改 Apex VisualForce 标签属性。
我可以做这样的事情吗?:
标签:
<apex:selectList id="Status" value="blah blah" multiselect="false" size="1">
在控制器中:
if (inc.Status__c == 'Closed'){
Status.Rendered = false
}
希望这是有道理的!
我目前正在这样做,我认为这有点啰嗦,希望避免:
标签
<apex:selectList id="Status" value="blah blah" rendered="{!IncidentIsClosed}">
控制器中的
if (inc.Status__c == 'Closed'){
IncidentIsClosed = false;
}
....
public Boolean getIncidentIsClosed() {
return IncidentIsClosed;
}
希望有所帮助!
I want to know if I can change Apex VisualForce tag attributes from the controller.
Can i do something like this?:
tag:
<apex:selectList id="Status" value="blah blah" multiselect="false" size="1">
in the controller:
if (inc.Status__c == 'Closed'){
Status.Rendered = false
}
Hope that makes sense!
I am current doing this, which i think is a bit long winded and want to avoid:
tag
<apex:selectList id="Status" value="blah blah" rendered="{!IncidentIsClosed}">
in the controller
if (inc.Status__c == 'Closed'){
IncidentIsClosed = false;
}
....
public Boolean getIncidentIsClosed() {
return IncidentIsClosed;
}
hope that helps!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
合并字段的语法(
{!...}
括号中的内容)与验证规则、公式字段、工作流程触发条件等相同。因此,您可以使用诸如TODAY()< 之类的函数/code> 以及一些更复杂的逻辑。
所以我认为如果“inc”对象在您的页面上可见,那么类似的东西
应该可以解决问题。如果您使用标准控制器,则将“inc”替换为 sObject 名称(如“Case”)。
Syntax for merge fields (stuff in
{!...}
brackets) is same as for validation rules, formula fields, workflow triggering conditions etc. So you can use functions likeTODAY()
as well as some more complex logic.So I think that if "inc" object is visible on your page then something like
should do the trick. If you use standard controller then replace "inc" with sObject name (like "Case").
我从 .NET 环境来到 Visualforce,在该环境中您可以从控制器更改页面(或者通过这种方式从控制器创建页面的一部分),所以我理解您的问题...
不幸的是,您无法执行以下操作Visualforce 中也是如此。
I came to Visualforce from a .NET environment where you could change the page from the controller (or by that means to create parts of the page from the controller), so I understand your question...
Unfortunately, you can't do the same in Visualforce.