function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Force2b_MikeForce2b_Mike 

Using Facet with Listviews tag does not work

According to the VisualForce documentation, I should be able to use the apexFacet tag along with the ApexListViews tag to override the body of the list view. However, when I try to save the page in the IDE it comes back with the following error message:

 

Save error: Unsupported attribute type in <apex:facet> at line 3 column 87

 

I've even tried removing everything between the open and close tags for the facet. As long as the facet tag appears this error comes up.

 

 

<apex:page>


<apex:ListViews type="Workshop__c" >
<apex:facet type="body">
<apex:column styleClass="dataCell">
<apex:outputField value="{!Workshop__c.Name}"/>
</apex:column>
<apex:column styleClass="dataCell">
<apex:outputField value="{!Workshop__c.ImplementationSite__c}"/>
</apex:column>
<apex:column styleClass="dataCell">
<apex:outputText value="{0,date,MM/dd}">
<apex:param value="{!Workshop__c.End_Date__c}" />
</apex:outputText>
</apex:column>
<apex:column styleClass="dataCell">
<apex:outputField value="{!Workshop__c.Number_of_Attendees__c}"/>
</apex:column>
<apex:column styleClass="dataCell">
<apex:outputField value="{!Workshop__c.Number_of_Completed__c}"/>
</apex:column>
</apex:facet>
</apex:ListViews>

</apex:page>

 

Best Regards,

 

Mike

jwetzlerjwetzler

Two things.  The error message is telling you exactly what you're doing wrong, there is no attribute called 'type' on apex:facet.  The only attribute facet has is 'name'.  See the component reference for more info.

 

The second problem is, you can't use apex:column like that.  Once you change your attribute name, I'm sure you'll run into another error telling you that it doesn't have the proper parent.  apex:column can only be used with apex:dataTable and apex:pageBlockTable (note that this is also documented in the component reference).  If you choose to wipe out the body of your listView you're pretty much starting from scratch.

 

From the listViews doc:

"Also note that if you define a body facet, it replaces the list of records that would normally display as part of the list view."

 

So you don't have access to your list of records.  {!Workshop__c.Name} is not going to resolve to anything because you have no controller or variable defined for it.

 

For what you're trying to build, you probably want to use apex:pageBlockTable with the Standard List Controller.  See this page for more info:

http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_sosc_list_views.htm

Force2b_MikeForce2b_Mike

Jill,

 

Oh.  That was too obvious wasn't it!? I just completely overlooked the "attribute type" in the error. Thanks!

 

For the columns, I honestly wasn't sure what it would accept within the body. The documentation is somewhat vague in that regards and there were no examples. I really was hoping that it would still give me the filtered views that have been created as the data set and that I just need to display the columns. I'd prefer to not to have to completely recreate the entire listView functionality if at all possible.

 

My issue is really that I don't want to display the Edit links in the List View, but I cannot remove the Edit permission for the Object from the users profile (they need that elsewhere). I had hoped I could just display the data columns less the action column. I suppose another option might be to use jQuery on the page to hide all links that have a class of 'ActionLink'. It's a workaround, but I think it might work. I'll give that a try tomorrow.

 

Thanks for your help.

 

Best Regards,

 

Mike

jwetzlerjwetzler

Sure thing.  Take a look at the last link I posted.  The example at the bottom shows how you can display filters for your users, but you'd have to write the pagination stuff (I think there are examples of that in the documentation too).  You can pretty much rewrite the listViews stuff and it's not too hard -- the only thing you lose is the "rolodex" at the top.

 

I would encourage you to think about the most intuitive way to solve your problem and then post that to the IdeaExchange.  You're not the first person I've heard who says all they want to do is remove the Edit and Delete links on the listViews and relatedList components.

Force2b_MikeForce2b_Mike

Jill,

 

Good suggestion! I posted this to the Idea Exchange: https://sites.secure.force.com/ideaexchange/ideaView?c=09a30000000D9xt&id=08730000000I3uN

 

Also, below is the final code that uses jQuery to remove the links:

 

 

<apex:page tabStyle="Workshops__tab">

<apex:includeScript value="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"/>

<apex:sectionHeader title="Data Entry Portal" subTitle="Workshops" />
<apex:pageMessages />

	<apex:ListViews type="Workshop__c" />

<script>
    // Using jQuery, hide all of the actionLinks on the Workshops
    // This forces the user to click the Workshop name and
    // then click the [Edit] button 
    $(".actionLink").css("display","none");
</script>

</apex:page>

 

Thanks for your help.

 

 

 

Best Regards,

 

Mike