6

I am trying to succeed at getting this jquery plugin to work corretly. What I need is a click event that will alow me to click a row and have a js window that will load another page using the row_id that is the primary key in the database. I'm really lost with javascript but I like the plugin and really would like to have this work if possible. I have been at this for a couple of days now. I know I'm close but haven't hit the mark yet. If someone could please help me, I'd be really grateful. I am using json to import the data.


Here is my current code. It will compile now but the .click event won't fire. :/

$(document).ready(function() {
  oTable = $('#search').dataTable(
  {
    "sPaginationType": "full_numbers",
    "bProcessing": true,
    "iDisplayLength": 15,
    "sAjaxSource": 'json.php',
    "fnInitCallback": function ()
    {
      $(oTable.fnGetNodes() ).click(function ()
      {
        //alert();
      });
    }
  });
});

1 Answer 1

6

You need to replace fnInitCallBack with fnInitComplete and it will work.

oTable = $('#search').dataTable({
    "sPaginationType": "full_numbers",
    "bProcessing": true,
    "iDisplayLength": 15,
    "sAjaxSource": 'json.php',
    "fnInitComplete": function (){
        $(oTable.fnGetNodes()).click(function (){
          // my js window....
        });
    }
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.