There are 2 objects one obj1 and obj2 I have to create dynamic table in visualforce page in which if new record is inserted to the obj1 then one row should be added to table and if one record in obj2 is inserted then one column should be added to the table.Please guide me to achieve this functionality.

Thanks In Advance

  • 2
    Can you share as to how far have you got till now? – Mohit Arora Jul 17 '17 at 5:57

public class unitStatusCls{ public list flrList{get;set;} //public list uniList{get;set;} public list floorList{get;set;} public unitStatusCls(){ flrList=new list(); //uniList=new list(); floorList=new list(); flrList=[SELECT name, (SELECT name FROM Units__r) FROM Floor__c]; //system.debug('flrList---------====='+flrList.size()); //system.debug('uniList---------====='+uniList.size()); }

 public class unitWrapper{
     public Unit__c uni{get;set;}
     public unitWrapper(){
       uni = new Unit__c();
 public class floorWrapper{
    public Floor__c flr{get;set;}
    public list<Unit__c> UniListW{get;set;}
    public floorWrapper(){
       flr = new Floor__c();
       UniListW = new List<Unit__c>();


VisualForce Page:-


  • How I can Achive this Functionality using wrapper class,Please guide me how I can achive this functionality using wrapper class. – Guru Jul 17 '17 at 6:41
  • Please share some of your code so that I can help you accordingly. – Mohit Arora Jul 17 '17 at 6:46
  • public class unitStatusCls{ public list<Floor__c> flrList{get;set;} public list<Unit__c> uniList{get;set;} public unitStatusCls(){ flrList=new list<Floor__c>(); uniList=new list<Unit__c>(); flrList=[SELECT id, Booking__c from Floor__c]; uniList=[SELECT Booking_Status__c, Block__r.name FROM Unit__c]; system.debug('flrList---------====='+flrList.size()); system.debug('uniList---------====='+uniList.size()); } } – Guru Jul 17 '17 at 6:54
  • I have just started – Guru Jul 17 '17 at 6:54
  • @Guru I have update the answer according to your controller. – Mohit Arora Jul 17 '17 at 7:34

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