+ Start a Discussion
sarvesh001sarvesh001 

Remove record from instance of wrapper class...


Hi ,
I want to delete record by using row index . Instead of wrapper class instance by using instance  List<object> i can do this.But with warpper class how can i get the recrords and remove the record.

It showing error
Method does not exist or incorrect signature: [LIST<addAttendee.turbinewrapper>].get(SOBJECT:Turbines__c)

Can any one suggest plaese ......

public turbinewrapper del;
public List<Turbines__c> delturbineList {get;set;}
public void deleteRow(){

rowIndex = Integer.valueOf(ApexPages.currentPage().getParameters().get('rowIndex'));
System.debug('rowbe deleted @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@' + rowIndex );
System.debug('rowm to be deleted '+turbineList[rowIndex]);
Turbines__c tur = new Turbines__c();
  del= turbineList.get(tur).remove(rowIndex);
delturbineList .add(del);


Regards,
sarvesh.
Tushar sharmaTushar sharma
you can try this approch 
public with sharing class Controller {
  public void removeRow(RowItem item) {
    for(integer i = 0; i < rows.size(); i++) {
       if(rows[i] == item) {
         rows.remove(i);
         break;
       }
    }
  }

  public RowItem[] rows { get; set; }

  public class RowItem {
    private Controller parentController;
    public RowItem(Controller parentController) {
      this.parentController = parentController;
    }
    public void removeRow() {
      this.parentController.removeRow(this);
    }
  }<br>  public Integer rowCount() {<br>    return rows.size();<br>  }
}
shiv@SFDCshiv@SFDC
Might be below modification in code can help you.
 
public List<Turbines__c> delturbineList {get;set;}

public void deleteRow(){

	rowIndex = Integer.valueOf(ApexPages.currentPage().getParameters().get('rowIndex'));

	delturbineList.add(turbineList.remove(rowIndex)) ; Be sure Indexig which you are doing On VF. starting from 0

	if(delturbineList > 0)
	{
		delete delturbineList ;
	}

}
If my answer help you to solve your issue. Please mark it as solution.
Thanks !