Hot answers tagged

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 ...
Adrian Larson's user avatar
  • 149k
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 ...
Santanu Boral's user avatar
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 ...
sfdcfox's user avatar
  • 481k
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 ...
sfdcfox's user avatar
  • 481k
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 ...
Santanu Boral's 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-...
NSjonas's user avatar
  • 10k
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, ...
sfdcfox's user avatar
  • 481k
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. ...
Eric's user avatar
  • 54k
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 ...
Adrian Larson's user avatar
  • 149k
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
Mohith Shrivastava's user avatar
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 ...
sfdcfox's user avatar
  • 481k
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 ...
Keith C's user avatar
  • 135k
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 ...
Boris Bachovski's user avatar
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>&...
cropredy's user avatar
  • 69.9k
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}" /...
Adrian Larson's user avatar
  • 149k
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 ...
Daniel Ballinger's 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 ...
Santanu Boral's 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[...
sfdcfox's user avatar
  • 481k
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[...
Tushar Sharma's user avatar
3 votes
Accepted

How I do check filesize of apex:inputfile when used in apex repeat

Use event.target to check the correct element: function checkFileSize(event) { if(event.target.files && event.target.files[0]) { if(event.target.files[0].size > 2**19) { alert('...
sfdcfox's user avatar
  • 481k
3 votes
Accepted

VF Error: When accessing certain properties of a field set

It seems that the issue is that I am using field as a variable name in more then 1 repeat tag on the page. Changing the name of field to seField resolved the error. Note: These tags are not nested. ...
gNerb's user avatar
  • 9,441
3 votes

Displaying a list returned from a method on a Visualforce page

Apex is a case-insensitive language. The identifiers pgm and PGM are the same as far as the compiler is concerned. In addition, there is a key logical error in the code populating this variable. Let's ...
David Reed's user avatar
  • 92.1k
3 votes
Accepted

How can I have an iterative component in apex:repeat (like a counter)?

Update following comment from sfdcfox : The wrapper solution to count row number is the "safest" solution because as per doc using below apex:variable method as a counter is not officially support ...
Shamina's user avatar
  • 4,185
3 votes
Accepted

apex repeat with dynamic list

You need to provide getters and setters to expose these properties to Visualforce: public class JsonGCloudApiApex { public class Item{ public string name {get; set;} public string id {get; set;...
David Reed's user avatar
  • 92.1k
3 votes
Accepted

Visualforce Error : Map key true not found in map

Your syntax first is incorrect. You have written <apex:repeat value="{!wrapperMap[India]}" var="key" id="Repeat12"> It should be <apex:repeat value="{!...
Nagendra Singh's user avatar
2 votes

How to detect first or last iteration of apex:repeat

Another way slightly different to Jennifer and without a controller, is to count each time it loops, and check if the last one is the same size as the list size: <apex:variable var="cnt" value="{!...
manza's user avatar
  • 1,945
2 votes
Accepted

Add dynamic value inside brackets of value

Assuming you are referring to the value that is in the label attribute on the inputField you can do this with array syntax the same way you're doing it with the value attribute. label="{!$ObjectType....
Mark Pond's user avatar
  • 22.9k
2 votes
Accepted

Iterate through a list in VF page using PageBlockTable

Access all fields in vf page <apex:pageBlockTable value="{! SkillReview }" var="ct" > <apex:column value="{! ct.Skill__c}"/> <apex:column value="{! ct.Name}"/> &...
Ratan Paul's user avatar
  • 22.5k
2 votes
Accepted

Dynamically change apex:repeat value on VF page

It's not clear to me if what you need is to do so when the page is being rendered or after. This is the approach to take if you were trying to do it during the rendering <apex:repeat value="{!...
Sebastian Kessel's user avatar
2 votes

repeat rendered for certain condition

You can use apex:variable to iterate throught your data, and for each sixth element rerender break line public class repeatCon { public String[] getStrings() { return new String[]{'one','...
Ilya Lepesh's user avatar
  • 4,115

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