0

I am not sure if my title made any sense, but here is what i actually wanted (feel free to change the title, i couldnt come up with a better one)

I want to build a VF page which displays data something like this

  Area            Allocated   Currently available
 - New York       20              15
    Vendor1       10              10
    Vendor2       10              5

 - Philadelphia   10              8
    Vendor1       5               5
    Vendor2       5               3

The question that i have is of how do i create a list to hold this type of data? How should that wrapper class be ?

Secondly (not very important) Is it possible to toggle to display and hide the vendors under each city. I would think jquery toggle could be used and its implementation would depend on the first question

Any pointers would be of great help

Thanks

1 Answer 1

3

It would appear that the Aggregation pattern (self referential) would be a good match. This is assuming that each instance only ever looks up to one Parent, sort of like a n - level Master-Detail.

public class Allocation{

    String assignedTo; //New York or Vendor 1
    Integer allocated;
    Integer available; // Either this or a total, and available = Total - allocated

    Allocation parent; //points to the Parent Allocation instance
}
1
  • 3
    To add to this. You could do a Map<Allocation,list<Allocation> MyMap New york and Philadephia would be your keys. your list of allocations will be your values. then you can use two nestled apex repeats. One that repeats through the Map. The second which will repeat through the list for each key. For Example See: blog.wdcigroup.net/2012/10/iterating-a-map-in-visualforce-page Then your list of vendors will be it's repeat that you could then toggle using a Rendered="{!DisplayMe}" and a button to flip DisplayMe to true and falst Commented Oct 18, 2012 at 20:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .