本文介绍了Visualforce自定义控制器列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要做的是创建一个自定义控制器列表,该列表显示机会,案例和可能的其他对象的混搭.我开始使用visualforce指南中的课程来开始学习:

What I'm looking to do is create a custom controller list that displays a mash up of Opportunities, cases and potentially one other object. I started using the class from the visualforce guide to get me going:

public with sharing class CasePagination {
private final Case c;

public CasePagination(ApexPages.StandardSetController controller) {
this.c = (Case)controller.getRecord();
}
public ApexPages.StandardSetController CaseRecords{
get {
if(CaseRecords == null) {
return new ApexPages.StandardSetController(Database.getQueryLocator(
[SELECT c.CaseNumber, c.AccountId, c.Subject, c.Status FROM Case c]));
}
return CaseRecords;
}
private set;
}
public List<Case> getCasePagination() {
return (List<Case>) CaseRecords.getRecords();
}
}

我修改了一些visualforce代码以显示案例列表:

I adapted some visualforce code to display a list of cases for now:

<apex:page standardController="Case" recordSetvar="cases" extensions="CasePagination">

<apex:pageBlock title="Viewing Cases">
<apex:form id="theForm">

<apex:pageBlockTable value="{!CasePagination}" var="c">
<apex:outputLink value="{!c.Id}">{!c.CaseNumber}</apex:outputLink>
<apex:column value="{!c.Id}"/>
<apex:column value="{!c.CaseNumber}" />
<apex:column value="{!c.Subject}" onclick="openCase"/>
<apex:column value="{!c.Status}" onclick="openCase"/>
</apex:pageBlockTable>

<apex:panelGrid columns="2">
</apex:panelGrid>
</apex:form>
</apex:pageBlock>
</apex:page>

我现在想做的是使表格中的项目可点击.我希望能够单击列表中显示的记录,并弹出记录.

What I'm trying to do now is make the items in the table clickable. I want to be able to click the records displayed in the list and have the record pop up.

谢谢.

推荐答案

您可以使用outputLink:

You could use an outputLink:

<apex:pageBlockTable value="{!CasePagination}" var="c">
    <apex:column value="{!c.Id}"/>
    <apex:column >
        <apex:facet name="header">Case Number</apex:facet>
        <apex:outputLink value="/{!c.Id}">{!c.CaseNumber}</apex:outputLink>
    </apex:column>
    <apex:column value="{!c.Subject}" onclick="openCase"/>
    <apex:column value="{!c.Status}" onclick="openCase"/>
</apex:pageBlockTable>

这篇关于Visualforce自定义控制器列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 17:52