You need to sign in to do that
Don't have an account?
apex:pageblocktable
<apex:pageblocktable>
the behavior is that it will let me put a value which can be associated with an array in my controller so it will be a variable number of rows depending upon how many elements are in that array.
Is there a way, instead, to have value indicate how many columns I have. I essentially want to flip what the rows and columns are. The reason is because in the table I want a variable number of columns and a set number of rows because I know that there will be more rows than columns. Even though the number of columns would be variable, it will be no more than maybe 6 or 7. But my number of set rows will be about 20. So it would be hard to read if there are 20 columns and only 6 or so rows.
I saw a dir attribute on pageblocktable, but that said it indicated left to right. Any help would be appreciated.
Hmmm. I think you'll need to use apex repeat components to do this - I can't see how you could dynamically write the columns in such a way that would be turned into HTML - you'd need 2 pass rendering really.
You can do this through repeat components and standard HTML table tags though - I've done something similar to display a month's worth of data in a diary type view - iterating the weeks, then for each week, output a row that iterates the days.
All Answers
This has cropped up a number of times in the past.
The solution is to carry out the transformation in your controller. E.g. you would create a custom class that contains a field for each column, then create a list of these classes with each element in the list representing a row of data.
I see now what you're saying; however, the problem is that I do not have a predefined number of columns. So creating a custom class with a field per column is not possible. I could create a list in my custom class but I don't think my pageblocktable can deal with a list of columns.
Bascially I am trying to make a custom report for our sales team where the x axis is salespeople (there is no predetermined number...it will query the User table to get the list) and the y axis would be a set number of pieces of information.
Example: Imagine this is a report where I could have a variable number of salespeople across the top in the x axis, but a set number of things in the y axis
Hmmm. I think you'll need to use apex repeat components to do this - I can't see how you could dynamically write the columns in such a way that would be turned into HTML - you'd need 2 pass rendering really.
You can do this through repeat components and standard HTML table tags though - I've done something similar to display a month's worth of data in a diary type view - iterating the weeks, then for each week, output a row that iterates the days.