Find your content:

Search form

You are here

how do i define a list to hold a summary data and then drill down further?


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


Attribution to: Prady

Possible Suggestion/Solution #1

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

Attribution to: techtrekker
This content is remixed from stackoverflow or stackexchange. Please visit

My Block Status

My Block Content