This document defines Apex classes to manage product line items. The ProdWrapper class defines properties for a product, and the ProdLineItems class manages lists of ProdWrapper objects to display and edit products in a Visualforce page. It initializes a list of sample products, allows adding and removing rows, and selects products when the form is submitted.
This document defines Apex classes to manage product line items. The ProdWrapper class defines properties for a product, and the ProdLineItems class manages lists of ProdWrapper objects to display and edit products in a Visualforce page. It initializes a list of sample products, allows adding and removing rows, and selects products when the form is submitted.
This document defines Apex classes to manage product line items. The ProdWrapper class defines properties for a product, and the ProdLineItems class manages lists of ProdWrapper objects to display and edit products in a Visualforce page. It initializes a list of sample products, allows adding and removing rows, and selects products when the form is submitted.
public String prodName {set;get;} public String prodCode {set;get;} public Integer quantity {set;get;} public Decimal price {set;get;} public Boolean flag {set;get;} public Decimal total {set;get;} }
public class ProdLineItems {
public List<ProdWrapper> items {set;get;} public List<ProdWrapper> selected {set;get;} public Integer rowNo {set;get;} public ProdLineItems(){ items=new List<ProdWrapper>(); addRows(); } public void addRows(){ for(Integer i=1;i<=3;i++){ ProdWrapper pw=new ProdWrapper(); items.add(pw); } } public void addEle(){ ProdWrapper pw=items.get(rowNo); items.add(rowNo+1,pw); } public void removeEle(){ items.remove(rowNo); } public void submit(){ selected=new List<ProdWrapper>(); for(ProdWrapper ps:items){ if(ps.flag==true){ selected.add(ps); } } } }