2

I've set my apex:pageBlockTable 'rows' attribute to 10 but it is collapsed when there are less than 10 records in the table. Is there a way to keep the number of rows fixed? Or will I have to switch to pure HTML table?

Thanks in advance!

1

You could add empty objects to the collection that the table is displaying (assuming you have a controller). Using Contact as an example and assuming <apex:pageBlockTable value="{!rows}" ...>

public Contact[] getRows() {
    Contact[] rows = [select Name from Contact limit 4];
    for (Integer i = rows.size(); i < 10; i++) {
        rows.add(new Contact());
    }
    return rows;
}
1
  • Thanks Keith! I ended up mixing your solution with html table + apex:repeat for its rows.
    – bananka
    Jul 17 '15 at 9:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.