Hi
I have a table which is populated by the following script. When I click on a row, I can go to another page, in this case "pay_invoices.php" and using the get method, the row id is sent across.No problems here, the code is below
My problem arises when I introduce the two lines to filter the data returned from the server, below the line starting "sAjaxSource"
When I introduce these two lines, the table stops rendering. I can render the table using the aoData without the fnDrawCallback or I can render the table with fnDrawCallback and no aoData filter, but not together. It is I suspect, a matter of closing braces, but for the life of me and all day spent at it, I'm no closer to sorting it.
Any help would be gratefully received.
David
I have a table which is populated by the following script. When I click on a row, I can go to another page, in this case "pay_invoices.php" and using the get method, the row id is sent across.No problems here, the code is below
var oTable; $(document).ready( function () { oTable = $('#tbl_purchase_invoices').dataTable( { "bProcessing": true, "bServerSide": true, "sAjaxSource": "datatables_data/purchase_invoice_data.php", "aoColumns": [ { "bVisible": true }, null, null, null, null ], "fnDrawCallback": function ( oSettings ) { $('#tbl_purchase_invoices tbody tr').each( function () { var iPos = oTable.fnGetPosition( this ); $(this).click( function () { window.location = "pay_invoice.php?id="+oSettings.aoData[iPos]._aData[1]; } ); } ); } } ); } );
My problem arises when I introduce the two lines to filter the data returned from the server, below the line starting "sAjaxSource"
var oTable; $(document).ready( function () { oTable = $('#tbl_purchase_invoices').dataTable( { "bProcessing": true, "bServerSide": true, "sAjaxSource": "datatables_data/purchase_invoice_data.php", "fnServerParams": function ( aoData ) { //THIS LINE aoData.push( { "name": "company_id", "value":"<?php echo $comp_id; ?>"}, //& THIS LINE "aoColumns": [ { "bVisible": false }, null, null, null, null ], "fnDrawCallback": function ( oSettings ) { $('#tbl_purchase_invoices tbody tr').each( function () { var iPos = oTable.fnGetPosition( this ); $(this).click( function () { window.location = "pay_invoice.php?id="+oSettings.aoData[iPos]._aData[1]; } ); } ); } } ); } );
When I introduce these two lines, the table stops rendering. I can render the table using the aoData without the fnDrawCallback or I can render the table with fnDrawCallback and no aoData filter, but not together. It is I suspect, a matter of closing braces, but for the life of me and all day spent at it, I'm no closer to sorting it.
Any help would be gratefully received.
David