function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shwetal DesaiShwetal Desai 

How can i keep track of selected rows of pageBlockTable using VFPage and controller?

Hi experts,

I have one VF Page with pageBlockTable which has a List in its "value" attribute.
what i want to do is.. i want a select facility on each row of table and i want to keep track of selected rows in a controller .. after that on click of button i would like to execute an action which will insert those selected rows into the database.

Is it possible?
how can i do this?
Any guidance, source code ??

Thanks in advance.
This should be helpful....
Shwetal DesaiShwetal Desai
Thanks a lot.......
its really very helpful to me... my problem is solve only coz of this article...

i have another question... can i ask, if u don't mind?

I have one VF Page for my custom object.. m doing save operation through controller using
"insert myObject;"

Now i want to set Record Id generated by this insert statement to one variable in controller... and i need to do this immediate after this insert statement.. is it possible?? how can i do this?

Thanks again,

Shwetal Desai
Glad the article was useful.

If myObject is a single object and not an list of objects you can get the id simply my adding ".Id" to the object after it is inserted.

Id obejctID = myObject.Id;

Message Edited by TehNrd on 10-21-2008 09:02 AM

hi TehNrd

the wrapper class very useful. but one problem comes out. I want to keep the standardcontroller's functionality of pagination. My question is the Next and Previous can not apply on the wrappered object set.

I need both pagination and tracking the selected rows functions. How can I achieve that.

Any idea will be great!!

Please make use of standardsetController released in Winter '09 release. in the controller use getselected() method