Hot answers tagged

12 votes
Accepted

visualforce IF syntax

"{!IF(AND(relation.First_Contact__c != null, relation.First_Contact__c != contact.Id), true, false)}"
user avatar
  • 14.5k
10 votes
Accepted

How to add page breaks to visual force page rendered as pdf so that a dynamically rendered list in apex repeat tag does not strech the table lines

I found an easy solution for the problem, no need to implement any logic for the same just included the following attribute -fs-table-paginate: paginate; in tables style tag and worked like a miracle.
user avatar
8 votes
Accepted

How to detect first or last iteration of apex:repeat

I rethought and this seems the best way so deleting the previous contents: Create a map<account,index> Put the account, index and also populate the last index in your method, and check if the ...
user avatar
  • 16.5k
8 votes

Why can Visualforce iterate over >1000 item collection if it's a map?

The original question asked how many records can be iterated, to which my answer is below. It seems that for all practical purposes, you are only limited by Viewstate/CPU/Heap when taking this ...
user avatar
  • 142k
7 votes
Accepted

How to iterate repetitive rows in table to calculate count and show the sum

I could think of preparing data based on SOQL query using GROUP BY ROLLUP I have replicated the data at my DE and following SOQL query is giving the exact formatting and summation which you are ...
user avatar
6 votes
Accepted

Visualforce list using Apex function and parameter

What you are looking to do is not possible. From what I understand, basically you would prefer to do something like this: <apex:repeat value="{!keyList}" var="key"> <apex:repeat value="{!...
user avatar
  • 19.5k
6 votes
Accepted

How to iterate over a list of objects in visualforce

You don't need to put "get" as it's resolved implicitly by Salesforce (getter methods are called as properties). so you should be able to use:- <apex:repeat value="{!Attributes}" var="att"> <...
user avatar
  • 2,559
6 votes
Accepted

<tr> and <td> tags within <apex:repeat> rendering above the table?

You need to use outputText instead of outputPanel. outputPanel is intended to be used as reRender targets, and to group content together. The documentation for outputPanel states: A set of content ...
user avatar
  • 430k
6 votes
Accepted

Using jQuery to add numeric values in Apex:repeat

You've got a few problems here. First, "total" isn't the ID of the repeat element in the traditional HTML sense. I'm pretty sure it doesn't even get rendered into the final HTML, so JavaScript can't ...
user avatar
  • 430k
6 votes

Group data and display on VF Page (use of rowspan)

I will take this approach to prepare the structure like this: 1) Create a ContactWrapper with all the Contact attributes. 2) In getData() method, retrieve the Contact List firing SOQL query ...
user avatar
5 votes

How to detect first or last iteration of apex:repeat

I think a more elegant solution would be to render items as an unordered list and then use css to render the commas. <style type="text/css"> .cs-list { display: inline; list-...
user avatar
  • 9,436
5 votes
Accepted

Displaying class properties in a VF repeat

Because you are referencing these in a VF page, the variables need to have getters public String partNumber {get; private set;} public String serialNumber {get; private set;} public String ...
user avatar
  • 61.4k
5 votes
Accepted

in apex:repeat, getter called twice in actionpoller rerender

Getters and setters may be called more than once. This is determined by the compiler and can't explicitly be forced. Generally, if you're doing anything in a getter, you should be caching the results, ...
user avatar
  • 430k
5 votes
Accepted

Wrapper Class in a Map

Use in the repeat caseInfo.CaseNumber Since caseInfo is akin to the loop variable in a for loop and each instance would be a wrapper record When using the repeats think of each one as a for loop. ...
user avatar
  • 53.1k
5 votes
Accepted

how to pass var from apex:repeat tag to controller

You don't need to pass it to Apex. Just use the $ObjectType global variable. Here I will rename your variables to be less confusing and conform to your description. Please also note it's label, not ...
user avatar
  • 142k
4 votes

How to add page breaks to visual force page rendered as pdf so that a dynamically rendered list in apex repeat tag does not strech the table lines

What you want to do typically requires a custom controller. There's an excellent tutorial in the Technical Library titled Creating Professional PDF Documents with CSS and Visualforce that describes ...
user avatar
  • 40.3k
4 votes

How to create tabs for an apex:tabPanel dynamically with apex:repeat and rerender?

Unfortunately you can't use the apex:tabPanel with the apex:repeat as you tried: apex:repeat This component can't be used as a direct child of the following components: <apex:panelBar>...
user avatar
  • 33.5k
4 votes

Unable to display map of <string, list> in repeat

This controller: public class MyController { public Map<String, List<String>> myMap { get { return new Map<String, List<String>>{ '...
user avatar
  • 129k
4 votes
Accepted

Add logic in VisualForce Page within apex repeat

While you can have some logic within repeat tags, you can't include literal Apex Code. You could, however, achieve this with either JavaScript (albeit clumsily), or by rendering this data with a ...
user avatar
  • 430k
4 votes
Accepted

Error when saving VisualForce email template "Error: Invalid Field"

The child relationship name has to be observed and __r needs to be appended . In your set up menu navigate to Object > field > and observe child relationship name
user avatar
4 votes

Rowspan with apex repeat

Examples such as this one HTML rowspan Attribute reduce the number of td elements in the following rows (as rowspan is effectively saying use the content from the previous row). So you need to ...
user avatar
  • 129k
3 votes
Accepted

Display limited repeat values in one pdf page

What you want to do requires a creating a controller that prepares pages for pagination based on the number of lines that are generated for each page (before sending them to the page for output) as ...
user avatar
  • 40.3k
3 votes
Accepted

apex repeat on multiple list values with one common id

I definitely think the wrapper class is the way to go; I use this method a lot especially as it helps to avoid view state issues. I would recommend not showing record Ids, and instead provide a ...
user avatar
3 votes

Stop blank page being created (because of page break setting) at end of visualforce rendered as pdf

The suggestion from How to deal with page breaks when printing a large HTML table seems applicable: Note: when using the page-break-after:always for the tag it will create a page break after the ...
user avatar
3 votes

Using nested apex:repeat and pageBlockTable in a page

Your prog variable is actually a record, not an index. It represents co in your Apex parallel. <apex:repeat value="{!myMap[data][emp]}" var="co"> <apex:outputText value="{!co.Field__c}" /...
user avatar
  • 142k
3 votes
Accepted

Using nested apex:repeat and pageBlockTable in a page

I had trouble making this work with pageBlockTable (or dataTable) but I could with apex:repeat Using this controller property with unimaginative accountNames: public map<Date,List<Account>&...
user avatar
  • 61.4k
3 votes
Accepted

Visualforce as PDF with table format

A couple of things here - Try set a width on the table and avoid using visualforce styling elements as they're not fully supported by the PDF renderer. Try to stick as much as you can to plain HTML ...
user avatar
3 votes
Accepted

ActionSupport: Pass record Id to Controller from apex:repeat

To pass the value from actionSupport to controller method, follow these steps: use apex:param with assignTo attribute to pass values to controller correctly use reRender attribute with actionSupport ...
user avatar
3 votes
Accepted

Sorting a keySet

Sets are never sorted. Instead, expose the list directly to Visualforce, and then iterate over each key value. <apex:repeat value="{!sortedKeys}" var="key"> <apex:repeat value="{!caseMap[...
user avatar
  • 430k
3 votes
Accepted

Getting data from list<MyCustomObject__c> with a List<String> of the Api Field Names

This will work you just need to change it little bit. For dynamic iteration of fields we pass them is sObject. This is similar with map iteration on visualforce. <apex:outputText value="co[...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible