Salesforce 我怎样才能得到一个;新";我的自定义顶点上的按钮:案例的pageBlockTable?

Salesforce 我怎样才能得到一个;新";我的自定义顶点上的按钮:案例的pageBlockTable?,salesforce,apex-code,visualforce,Salesforce,Apex Code,Visualforce,我有一个自定义案例顶点页面,在该页面中,我使用apex:pageBlockTable显示案例列表。下面是它的代码: <apex:page standardController="Case" recordSetVar="Case" sidebar="true" showHeader="true"> <apex:form > <apex:pageBlock title="Cases"> <apex:outp

我有一个自定义案例顶点页面,在该页面中,我使用
apex:pageBlockTable
显示案例列表。下面是它的代码:

<apex:page standardController="Case" recordSetVar="Case" sidebar="true" showHeader="true">
    <apex:form >
        <apex:pageBlock title="Cases">
              <apex:outputLabel value="View:"/>
              <apex:selectList value="{!filterId}" size="1">
                <apex:actionSupport event="onchange" rerender="cases_table"/>
                <apex:selectOptions value="{!listviewoptions}"/>
              </apex:selectList>
            <apex:pageBlock >
                <apex:pageBlockButtons >
                </apex:pageBlockButtons>
                <apex:pageBlockTable value="{!case}" var="c" rows="50" id="cases_table" >
                    <apex:column >
                        <a target="_parent" href="{!URLFOR($Action.Case.View, c.id)}">{!c.CaseNumber}</a>
                        <apex:facet name="header">Case Number</apex:facet>
                    </apex:column>
                    <apex:column value="{!c.ContactId}" />
                    <apex:column value="{!c.Subject}" />
                    <apex:column value="{!c.Status}" />
                    <apex:column value="{!c.Priority}" />
                </apex:pageBlockTable>
            </apex:pageBlock>
        </apex:pageBlock>
    </apex:form>
    <base target="_parent"/>
</apex:page>
但这给了我一个错误。如何制作一个按钮,将我带到“新案例”页面?

试试以下方法:

<apex:commandButton onclick="window.location.href='{!URLFOR($Action.Case.NewCase)}'" value="New" immediate="true" rerender="blank"/>

重要的是要注意,需要rerender标记,否则页面将进行回发。通过使用一个虚拟的rerender标记,重定向将起作用。存在Immediate以避免在单击时运行任何验证规则

试试这个:

<apex:commandButton onclick="window.location.href='{!URLFOR($Action.Case.NewCase)}'" value="New" immediate="true" rerender="blank"/>


重要的是要注意,需要rerender标记,否则页面将进行回发。通过使用一个虚拟的rerender标记,重定向将起作用。存在Immediate以避免在单击时运行任何验证规则

我有一个自定义的
Cases-apex
页面,其中我使用
apex:pageBlockTable
来显示我的案例列表。以下是它的代码(自定义对象):


我有一个自定义的
案例顶点
页面,其中我使用
顶点:页面块表
来显示案例列表。以下是它的代码(自定义对象):



我最后做了这件事:
。一种方式比另一种好吗?我的路需要“重播器”吗?谢谢。实际上你可能教了我一些东西。我现在不知道你能为行动提供这样的公式。在这种情况下,您将不需要重新加载标记。我最终这样做:
。一种方式比另一种好吗?我的路需要“重播器”吗?谢谢。实际上你可能教了我一些东西。我现在不知道你能为行动提供这样的公式。在这种情况下,您将不需要重新加载标签。
<apex:commandButton action="{!URLFOR($Action.Your_Custom_Object__c.New)}" ...>