You need to sign in to do that
Don't have an account?
Siddharth Mani
Dynamic columns and rows as columns in pageblock or datatable
I have a pageblock table and its the most basic version at that. The requirement is to have dynamic columns based on the values of a particular field value and other columns grouped below this one.For eg. my data is like this:
I want the output as:
And similarly if there are more accounts/fields, they should be grouped and displayed accordingly. Could someone please guide as to how to proceed on this?
I want the output as:
And similarly if there are more accounts/fields, they should be grouped and displayed accordingly. Could someone please guide as to how to proceed on this?
I've been working on an example for you, but it's tough going. You're better off generating the table, tr, and td tags yourself, or looking into a third party library like datatables.net that may be able to do this sort of grouping for you.
If you're still interested in going the pageBlockTable route, however, this link will come in handy for the dynamic columns:
http://salesforce.stackexchange.com/questions/245/dynamic-number-of-columns-in-a-pageblocktable
Controller:
VF Page:
The issue I am facing now is that all the columns have the same set of data in them and not filtered by date (of course I understand that I havent filtered anywhere in my query or anything). But am unable to understand as to where I should apply the filter in the code to display only the records of that particular date in the table and not others. All this is using standard objects and controllers, so you can directly copy and use the code to see how its working (Please dont get confused with the names - Code is from my personal org and so everything happed at the spur of the moment :) ).