You need to sign in to do that
Don't have an account?

Having an individual UPDATE button next to each record on VF page
I have a VG page that shows all existing contacts on an Account, as well as allows you to add new contacts to the Account; it does so through a pageblockTable and some extensions. I need a way to add an Update button next to each one of the lineitems on the pageblockTable to allow the user to make a change to one Contact and then quicksave it separate from the rest.
Is this possible?
You'd have a CommandButton or CommandLink in your row - and between the open/close tags of that CB or CL, you'd have <apex:param>.
Then, in your controller, you'd have:
Let me know if that helps...
All Answers
It is!
The update buttom shall be a commandbuttom with a parameter with the id contact value you want to update.
The controller will receive that parameter. Find in the list which is linked to the pageBlockTable the right contact. and then do the DML update instruction.
Don't need to rerender the pageBlockTable.
PS: If it solve yor problem mark it as "solution"
Are you saying that I need to add a save method to my class? If so, how do I reference the specific row that the user is on and have the save only apply to that row?
Best way I'd do it is via a helper class in your PageBlockTable. The CommandButton would invoke a custom method in your controller - you would pass through (or otherwise set) the helper class object when the CommandButton is pressed and your update logic would be fired. Voila!
-Andy
make use of apex param tag to send the id of the record for which the button is clicked. Use the id in the controller to perform the update operation
Let me know if u need an example
@rasechtcs, It makes sense how to use the param tag in the VF page, but I would greatly appreciate an example of how to incorporate that into the class.
You'd have a CommandButton or CommandLink in your row - and between the open/close tags of that CB or CL, you'd have <apex:param>.
Then, in your controller, you'd have:
Let me know if that helps...