如何将参数从可迭代组件传递给我的控制器?我正在使用带有输入复选框的 actionSupport 来调用我的控制器中的操作方法。我需要将两个值传递回我可以在内部类中引用的控制器,并在内部类中的两个属性上设置值。
这是我的 VF 页面的相关部分:
<apex:pageBlock id="participantBlock">
<apex:pageBlockButtons location="top" id="topBtnParticipant">
<apex:commandButton id="btnParticipant" value="Add Participant" action="{!addParticipant}" reRender="participantTable" />
</apex:pageBlockButtons>
<apex:pageBlockSection title="Participants" columns="1" id="participantSection">
<apex:pageBlockTable id="participantTable" value="{!participantLinesForPage}" var="part">
<apex:column style="white-space:nowrap;text-align:center;" width="4%">
<apex:commandLink rerender="participantTable" action="{!deleteParticipant}">
<apex:param name="del" value="{!part.iterate}"/>
<apex:image id="deleteImage" value="{!URLFOR($Resource.Icons, 'delete.png')}" width="16" height="16"/>
</apex:commandLink>
</apex:column>
<apex:column headerValue="Contact" width="30%">
<apex:inputHidden value="{!part.contactId}" id="targetContactId" />
<apex:inputText value="{!part.contactName}" id="targetContactName" onFocus="this.blur()" disabled="false" style="width:175px;" />
<a href="#" onclick="openContactLookupPopup('{!$Component.targetContactName}', '{!$Component.targetContactId}', 'userLookupIcon{!part.iterate}', 'accountLookupIcon{!part.iterate}'); return false" ><img onmouseover="this.className = 'lookupIconOn';this.className = 'lookupIconOn';" onmouseout="this.className = 'lookupIcon';this.className = 'lookupIcon';" onfocus="this.className = 'lookupIconOn';" onblur="this.className = 'lookupIcon';" class="lookupIcon" src="/s.gif" id="contactLookupIcon{!part.iterate}" /></a>
</apex:column>
<apex:column headerValue="Add Task" width="6%" headerClass="columnAlignment" styleClass="columnAlignment">
<apex:inputCheckbox value="{!part.selected}" disabled="{!IF(part.selected == true, true, false)}" >
<apex:actionSupport event="onchange" action="{!addTaskFromParticipant}" oncomplete="this.disabled=true;" rerender="taskTable" />
<apex:param value="{!part.contactId}" assignTo="{!whoid}" />
<apex:param value="{!part.contactName}" assignTo="{!whoname}" />
</apex:inputCheckbox>
</apex:column>
<apex:column headerValue="User" width="30%">
<apex:inputHidden value="{!part.userId}" id="targetUserId" />
<apex:inputText value="{!part.userName}" id="targetUserName" onFocus="this.blur()" disabled="false" style="width:175px;" />
<a href="#" onclick="openUserLookupPopup('{!$Component.targetUserName}', '{!$Component.targetUserId}', 'contactLookupIcon{!part.iterate}', 'accountLookupIcon{!part.iterate}'); return false" ><img onmouseover="this.className = 'lookupIconOn';this.className = 'lookupIconOn';" onmouseout="this.className = 'lookupIcon';this.className = 'lookupIcon';" onfocus="this.className = 'lookupIconOn';" onblur="this.className = 'lookupIcon';" class="lookupIcon" src="/s.gif" id="userLookupIcon{!part.iterate}" /></a>
</apex:column>
<apex:column headerValue="Account" width="30%">
<apex:inputHidden value="{!part.accountId}" id="targetAccountId" />
<apex:inputText value="{!part.accountName}" id="targetAccountName" onFocus="this.blur()" disabled="false" style="width:175px;" />
<a href="#" onclick="openAccountLookupPopup('{!$Component.targetAccountName}', '{!$Component.targetAccountId}', 'contactLookupIcon{!part.iterate}', 'userLookupIcon{!part.iterate}'); return false" ><img onmouseover="this.className = 'lookupIconOn';this.className = 'lookupIconOn';" onmouseout="this.className = 'lookupIcon';this.className = 'lookupIcon';" onfocus="this.className = 'lookupIconOn';" onblur="this.className = 'lookupIcon';" class="lookupIcon" src="/s.gif" id="accountLookupIcon{!part.iterate}" /></a>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
我试图使用<apex:param>
组件和assignTo
属性。但是,这永远不会触发。
当用户选中该复选框时,我想传递该特定记录的 contactId 和 contactName<apex:pageBlockTable>
并将其设置为等于属性whoid
和whoname
然后我可以在我的内部类中引用这些属性,并将值设置为等于我在我的内部类中定义的几个属性,这些属性在我的 VF 页面的其他地方使用。有没有办法做到这一点?
谢谢你的帮助。问候。