Skip to main content
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
  • 151k
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

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
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
  • 497k
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
  • 497k
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
  • 10.2k
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
  • 54.2k
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
  • 151k
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
  • 136k
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

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
  • 497k
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
  • 497k
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,510
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
  • 93.2k
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,295
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
  • 93.2k
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,953
2 votes

apex:repeat to show and edit multiple record

You have a couple of issues here public void submitOrder(){ update this.promoItems; } is void and does no redirect. Hence <apex:commandButton id="submit" action="{!submitOrder}" value="Order"/&...
cropredy's user avatar
  • 72.1k
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

Map key null not found in map for properly built map

I don't know exactly why yet, but it is something to do with the apex:pageBlockTable iterating over the map keys. If you swap it out with a basic apex:repeat it works fine. E.g. Change this: <...
Daniel Ballinger'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,125
2 votes
Accepted

Dynamic Apex:Repeat size (adding rows)

Basically, whenever you have a variable, you need to initialize it. Since you failed to do so, you got the NullPointerException. To resolve this, you need to add a no-args constructor in order to ...
sfdcfox's user avatar
  • 497k
2 votes
Accepted

Apex repeat shows Ids instead of field values

If your two records have same value then the Set will not help you and you will get duplicates. So you can do something like public Set<string> getRepList(){ Set<String> strSet = new ...
Tushar Sharma's user avatar
2 votes

Not sure why but apex:repeat returning Previous rows of the List

Since your code is incomplete it is tough to say... What I can give you is an example based off of Accounts. The gist is Select an Account, click add A section will be added with the Account and ...
Eric's user avatar
  • 54.2k
2 votes
Accepted

Passing counter variable (apex:repeat + apex:var) into apex:assignTo yields 'null'

You have to rerender the form in commandButton <apex:commandButton action="{!deleteNewChild}" rerender="yourform" value="Remove"> <apex:param name="indexOfNewChildToRemove" ...
Santanu Boral's user avatar
2 votes

Using IF statement in a VisualForce page's For(repeat) loop?

Your syntax is a little bit all over the place. Here's how I would structure the format in a clean (easy to read), multi-line manner. Here I will change casHistory to history for my own sanity: IF( ...
Adrian Larson's user avatar
  • 151k
2 votes

how to default select a value - html select inside <apex:repeat>

I believe there is no way you can do it via standard repeat: As you commented and it is also documented: HTML5 specifications https://www.w3.org/TR/html51/sec-forms.html#the-option-element The ...
manjit5190's user avatar
  • 8,043

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