I have this sample page created that uses Jquery datatable within that I'm using <apex:actionsupport> and when I click on the hyperlink for that particular column it does not fire the event and the way I'm testing is that when the user clicks on the a href it fires the action method on the controller and I'm spitting the system.debug just to make sure it does calling this method. When I looked at the log it does not show that action method fires, what I'm doing wrong here?


 <apex:form id="myform"> 
            <apex:includescript value="//code.jquery.com/jquery-1.11.1.min.js" / >
                <apex:includescript value="//cdn.datatables.net/1.10.4/js/jquery.dataTables.min.js" />
                <apex:stylesheet value="//cdn.datatables.net/1.10.4/css/jquery.dataTables.css" />
                j$ = jQuery.noConflict();
                j$(document).ready( function () {
                    var tbl = j$('[id$="tbl"]').DataTable({
                        //for empty
                        "columnDefs": [{
                            "defaultContent": "empty",
                            "targets": "_all"

<table class="table table-striped table-hover" id="tbl" >
                    <apex:repeat value="{!myData}" var="t" id="reg">
                                <apex:actionsupport action="{!loadDataById}" event="onclick" rerender="pb2" >  
                                <a href="#"><apex:param name="selectedId" value="{!t.Id}">{!t.Name}</apex:param></a>
                            <td>{!t.description} </td> 

          <apex:pageblock id="pb2 ...>



public List<my_custom_object> secondList { get; set; } 
public void loadDataById()
    String selectedId = System.currentPagereference().getParameters().get('selectedId');
    List<my_custom_object>  myDataList = [SELECT ...];
    system.debug('selectedid: ' + selectedId);
    secondList = myDataList ; 
  • Can you try with apex:outputLink instead of plain a tag? See if it works..
    – javanoob
    Jan 10, 2017 at 17:27

1 Answer 1


You have to nest the <apex:actionSupport> tag within the tag whose action you are trying to support. You have it inverted.


<a ...>
    <apex:actionSupport ... />


<apex:actionSupport ...>
    <a ...>

However, it appears you may want to simply use the <apex:commandLink> tag here...


    <apex:commandLink action="{!loadDataById}" rerender="pb2">
        <apex:param name="selectedId" value="{!t.Id}" />

No Joy

    <apex:actionSupport ... />
    <a ...>
        <apex:param ...>

Or if you are really committed to sticking with an <a> tag for some reason, at least follow the approach outlined in the documentation on <apex:actionSupport>, adapted below to closer mirror your situation. Basically you want to add the click listener to a wrapper div.

<apex:page controller="Throwaway">
        <apex:outputpanel id="counter">
            <a href="#">Click Me!: {!count}</a>
            <apex:actionSupport event="onclick" action="{!incrementCounter}" rerender="counter"/>
  • Adrian, did not help either so when I click on the hyperlink it does not fire the event and i do not see any activity in the logs.
    – Nick
    Jan 10, 2017 at 17:16
  • I did not know that we can use actionSupport for plain HTML elements, I thought only for apex namespace elements.
    – javanoob
    Jan 10, 2017 at 17:25
  • Joy snippet worked! 1+
    – Nick
    Jan 10, 2017 at 18:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .