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
Arek S.Arek S. 

Clickable DataTable Cells - How to get Column and Row information

I'd like to create a datatable where each cell is clickable.  I'm assuming that I can probably fill each cell with apex:outputlink and that takes care of the clickable part as well as calling my controller for each click.  The big question I need an answer for is how do I pass information to my apex controller about which cell (ie: which row and which column) was actually clicked.

 

Any help for this is highly appreciated.

 

Thanks.

bob_buzzardbob_buzzard

You'll need to have some information in the cell that can be used to identify the related record and field. You can then pass this as an apex:param on the apex:outputlink.

 

I've written a blog post on how parameters actually get passed from Visualforce to the controller at:

 

http://bobbuzzard.blogspot.co.uk/2011/07/passing-parameters-to-apex-method-from.html

Arek S.Arek S.

Thanks, however, the problem I'm running into is not how to pass the data to the controller, it's how to get the data in the first place.  Or in other words ... since the datatable rows are created dynamically based on how much data exists in the property that the datatable is drawing it's data from, how do I go about adding values into the rows so that I can then pass them to my controller?

 

Thanks.

bob_buzzardbob_buzzard

What information are you backing the table with?  Is it a list of sobjects, a list of custom classes or something else?