+ Start a Discussion
JHAJHA 

how to desing wrapper class and use list on that object?

All i need to design UI page in given below scenario. 

say i have customer and product master. i want combination of 1 customer and all product , for all customers.

 

if i have 2 customer a,b

            3  product    c,d,e

 

i want following combination on page load of my UI

 

                               Customer     product

                                       a                  c

                                        a                  d

                                        a                  e

                                        b                  c     

                                        b                   d

                                        b                   e

im able to get customer in one list and product on other list but cant able to  desing wrapper class and merge those list on that object.

 

My code piece is below

 

// controller public with sharing class ForecastController{ private List<newcustomer__c> Customer; Private List<newproduct__c> Product; public List<newcustomer__c> getCustomer() { Customer=[SELECT name FROM newcustomer__c a ]; return Customer; } public List<newproduct__c> getProduct() { Product=[SELECT name FROM newproduct__c a ]; return Product; } } //Page <apex:page controller="ForecastController"> <apex:form > <apex:pageBlock title="Forecast Entry Form"> <apex:pagemessages /> <apex:pageblockButtons > <apex:commandButton Value="Save" /> <apex:commandButton value="Cancel" /> </apex:pageblockButtons> <apex:pageblockSection > <apex:dataTable value="{!Customer}" var="a" styleClass="list"> <apex:column > <apex:facet name="header">Customer Name</apex:facet> <apex:inputfield value="{!a.name}" /> </apex:column> <apex:column > <apex:facet name="header"> <div align="left"> Month1 </div> </apex:facet> <input maxlength="80" name="sbstr" size="3" type="text" /> </apex:column> <apex:column > <apex:facet name="header"> <div align="left"> Month2 </div> </apex:facet> <input maxlength="80" name="sbstr" size="3" type="text" /> </apex:column> </apex:datatable> </apex:pageblockSection> </apex:pageBlock> </apex:form> </apex:page>

 

 

   Anyone can please help ? Thanks!