+ Start a Discussion
justinhowell82justinhowell82 

PageBlockTable checkbox selecting multiple records

I have a custom vf page on a Quote page layout to display all the Quote Lines in a page block table.  The standard related list was far to limited for what we need.  I have the table displaying correctly with the first column being a checkbox with a select all box in the header.  What I want to happen is to link to another page to edit just the selected records when a user clicks a button on the page.  This has to be very simple but I can not figure out how to capture the selected records in the pageblock table and pass those to my new edit page.  

 

Thanks,

Justin

Sonam_SFDCSonam_SFDC

This functionality as you explained requires to process only the selected records - this can well be acheived using the Wrapper class:

http://wiki.developerforce.com/page/Wrapper_Class

 

The example and sample code should give you an idea as to how you can edit the VF page.

justinhowell82justinhowell82

Sonam, thanks for your quick response.  I think that has got me a good start.  I got that to work with my objects but after I have my selected records list what is the best way to pass that collection to a new page so I can load another table just showing the records selected on the previous page so that they can be edited in mass?

 

So the flow would be vf page 1 has a table of all quote lines with checkboxes and a button to edit quote lines.  Quote Lines will be selected and the edit button will be clicked which will redirect to vf page 2 which will have all the selected records in a table for editing.

 

Also, If I do not use the standard Quote controller how can I make my custom vf page show up on the quote page layout?

 

Thanks,

Justin

Sonam_SFDCSonam_SFDC

Hi Justin, Glad I am able to help..

 

Check the step by step explaination as to how to can process the selected recods in the wrapper in the following link.

 http://stackoverflow.com/questions/14823107/how-to-find-out-which-checkboxes-have-been-selected-on-the-next-page-in-visualfo

 

For Quote page layout :

use apex:detail to show the detail as shown on the standard page  http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_detail.htm

 

use apex:relatedlist to get the related lists on the Quote standard page:

http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_relatedList.htm