If you select multiple records through checkbox then you can not do the same. but using multiple chckbox and inline editing is possible, means inline editing of all records you have selected . If you want to do the same then there are two solutions either you can use inlineEdit tag or you can use rendered attribute. If you want the salesforce standard funtionality that in each record there is a edit button then you can do the same with the help of actionFunction and apex:Param.
ApexPages.StandardSetController setCon; public Account account{get;set;} public List<Account> acclist; public UController(ApexPages.StandardSetController controller) { setCon = controller;
}
public pageReference save() { // do something with the selected records for ( Account acc : (Account[])setCon.getSelected() ) { // System.debug('Account name = ' + acc.Name); acclist=[Select Name,Type,BillingState from Account Where Name =:acc.Name ]; update acclist; } return null; } /* public List<Account> getAccountData() { account=[Select Name,Type,BillingState from Account]; acclist.add(account); return acclist; }
public pageReference save(){ getAccountData(); update account;
If you select multiple records through checkbox then you can not do the same. but using multiple chckbox and inline editing is possible, means inline editing of all records you have selected .
If you want to do the same then there are two solutions either you can use inlineEdit tag or you can use rendered attribute.
If you want the salesforce standard funtionality that in each record there is a edit button then you can do the same with the help of actionFunction and apex:Param.
Please let me know which solutions do you want.
Thanks
Shivdeep
i want to save changes like this using a controller
ApexPages.StandardSetController setCon;
public Account account{get;set;}
public List<Account> acclist;
public UController(ApexPages.StandardSetController controller)
{
setCon = controller;
}
public pageReference save()
{
// do something with the selected records
for ( Account acc : (Account[])setCon.getSelected() )
{
// System.debug('Account name = ' + acc.Name);
acclist=[Select Name,Type,BillingState from Account Where Name =:acc.Name ];
update acclist;
}
return null;
}
/* public List<Account> getAccountData() {
account=[Select Name,Type,BillingState from Account];
acclist.add(account);
return acclist;
}
public pageReference save(){
getAccountData();
update account;
return null;
}*/
}
Please take a look on below link, it will help you,
https://www.linkedin.com/pulse/how-do-inline-edit-custom-visualforce-page-ravi-kant
http://salesforceworld.blogspot.in/2011/06/inline-editing-in-visualforce-page.html
http://sfdcsrini.blogspot.com/2014/08/inline-editing-in-visualforce-page.html
Please let me know if this help, else post the vf page also I ll correct that.
Thanks
Shivdeep