views:

1542

answers:

2

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();
      });
    }
  });
});
+2  A: 

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....
        });
    }
});
Jose Basilio
A: 

?_? ....oTable is undefined !!!

paskuale
P.S.replace "fnInitComplete" with "fnDrawCallback" it's solution xD
paskuale