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
jayamjayam 

Onrowclick

hi

 

 i want to display the detail page when  i click on a row in the datatable.

but here we should not write onclick function

for all the columns in row, we have to mention only one time that onclick function and also detail page should be dislayed when we click on any column in that row

 

how can do this?

 

thanks in advance...

 

bob_buzzardbob_buzzard

You can specify an onrowclick handler for datatable, but the trick is going to be detecting which row you are on.  You may be able to figure this out by walking the dom.

 

I've done similar in the past but ~I was using standard html tables and thus could set the onclick stuff up correctly.

Pradeep_NavatarPradeep_Navatar

Have you tried the "onchange" event of javascript and use the window.open(url, 'DETAILPAGE',Page properties) for opening the detail page? Try using this and let me know if you get in to any issues.

 

DHitzelDHitzel

After some trial an error, I was able to imlement the following...

 

    <script type="text/javascript">
        function clickedRow(tableRow) {
            alert('clickedRow: ' + tableRow.rowIndex);
        }
    </script>

<apex:dataTable id="mapPointTable" headerClass="table_header" value="{!mapPointList}" var="mapPoint" onRowClick="clickedRow(this)">

Hope it helps...