听起来很简单,但我从多个字段集中获取表中输出的值,因此管理员用户可以自定义表中显示的列。
这是我的功能页面块...
<apex:pageBlock title="{!$Label.Search_Results}">
<apex:pageBlockTable value="{!SearchResults}" var="pictureGallerySearchResult" title="SearchResults">
<apex:column headerValue="Image" styleClass="imageDataCell">
<a target="_blank" href="/servlet/servlet.FileDownload?file={!pictureGallerySearchResult.ActualAttachment.Id}" >
<img class="searchResultImage" style="{!SearchResultsImageStyle}" src="/servlet/servlet.FileDownload?file={!pictureGallerySearchResult.ActualAttachment.Id}" alt="{!pictureGallerySearchResult.ActualAttachment.Name}"/>
</a>
</apex:column>
<apex:column headerValue="Test" value="{!pictureGallerySearchResult.Project[pictureGallerySearchResultField]}"/>
<apex:repeat value="{!$ObjectType.Project__c.FieldSets.Picture_Gallery_Search_Results}" var="pictureGallerySearchResultField">
<apex:column headerValue="{!$ObjectType.Project__c.Fields[pictureGallerySearchResultField].label}" value="{!pictureGallerySearchResult.Project[pictureGallerySearchResultField]}"/>
</apex:repeat>
<apex:repeat value="{!$ObjectType.Store__c.FieldSets.Picture_Gallery_Search_Results}" var="pictureGallerySearchResultField">
<apex:column headerValue="{!$ObjectType.Store__c.Fields[pictureGallerySearchResultField].label}" value="{!pictureGallerySearchResult.Store[pictureGallerySearchResultField]}"/>
</apex:repeat>
<apex:repeat value="{!$ObjectType.Visit__c.FieldSets.Picture_Gallery_Search_Results}" var="pictureGallerySearchResultField">
<apex:column headerValue="{!$ObjectType.Visit__c.Fields[pictureGallerySearchResultField].label}" value="{!pictureGallerySearchResult.Visit[pictureGallerySearchResultField]}"/>
</apex:repeat>
<apex:repeat value="{!$ObjectType.Photo_Attachment__c.FieldSets.Picture_Gallery_Search_Results}" var="pictureGallerySearchResultField">
<apex:column headerValue="{!$ObjectType.Photo_Attachment__c.Fields[pictureGallerySearchResultField].label}" value="{!pictureGallerySearchResult.PhotoAttachment[pictureGallerySearchResultField]}"/>
</apex:repeat>
</apex:pageBlockTable>
</apex:pageBlock>
您可以看到我在第一列中为图像创建了一个“硬编码”超链接,但是如果它是自定义对象的名称字段,我想动态地超链接一个字段。
例如,如果字段集...
$ObjectType.Project__c.FieldSets.Picture_Gallery_Search_Results
...包含一个名为“名称”的字段,我想插入一个超链接,将您带到销售人员页面以查看该项目。
因此,首先我需要能够确定该字段是否是自定义对象名称字段,其次,输出超链接而不是标签。
如果有人有任何想法,我将不胜感激。
感谢您抽时间阅读。