我在 visualforce 组件中有一个命令按钮。预期的行为是调用控制器方法。页面刷新了,但是{!performUnlinkContact}没有调用commandButton中注册的方法。奇怪的是,如果我将按钮放在基本 visualforce 页面上,它会按预期调用控制器方法 - 但在组件中时,它不会。
这是我的组件:
<apex:component >
    <apex:attribute name="rk" description="RK Base Contact Data"  type="Object" required="true"/>
    <div class="unlinkBox">
        <div class="unlinkHeader">
            <div class="unlinkHeaderLeft">Wrong Contact?</div>
            <div class="unlinkHeaderRight"><a href=""  onclick="return hideUnlinkPanel()"><apex:image style="cursor: pointer;" value="{!$Resource.x}" alt="Close Panel" /></a></div>
        </div>
        <div class="unlinkBody">
            <div class="unlinkBodyLeft">
                Click Yes if the Contact displayed is incorrect.<br/><br/>You will be given the opportunity to link to a different Contact.
            </div>
            <div class="unlinkBodyRight">
                <apex:outputpanel id="callMethod">
                    <apex:commandbutton value="Yes, this is the wrong contact" action="{!performUnlinkContact}" rerender="" status="myDisplayStatus" />    <a onclick="return hideUnlinkPanel()" style="color:blue;cursor:pointer;text-decoration:underline">No</a>
                </apex:outputpanel>
                <apex:actionStatus id="myDisplayStatus"  startText="(performing Contact Unlink...)"  stopText=""/>
            </div>
        </div>
    </div>
</apex:component>
这是控制器扩展中的方法:
public PageReference performUnlinkContact() {
     System.debug('==================================!!performUnlink');
    if (this.thisLead.rkContactId__c != 0) {
        this.thisLead.rkContactId__c = 0;
        update this.thisLead;
    }
    return null;
}
我确定我一定是做错了什么,因为我是 salesforce 的新手并且仍在学习,但是当我搜索如何解决这个问题时,我找不到任何相关的问题。在此先感谢您的帮助。