clickable row and link to new page
clickable row and link to new page
I've read over the forums but I do not know enough about jquery to understand what the problem is so.
[code]
var oTable;
$(document).ready(function() {
$('#example').dataTable( {
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bProcessing": false,
"iDisplayLength": 30,
"bServerSide": true,
"sAjaxSource": "data_table_includes/customer_table.php",
"aoColumns":[
{ "sName": "customer_number" },
{ "sName": "customer_name" },
{ "sName": "email" },
{ "sName": "phone" }
],
"fnDrawCallback": function( oSettings ) {
$('#example tbody tr').click( function() {
var iPos = oTable.fnGetPosition( this );
alert( oSettings.aoData[iPos]._aData[0] );
window.location = "whatever.php?id="+oSettings.aoData[iPos]._aData[0];
} );
}
} );
} );
[/code]
[code]
var oTable;
$(document).ready(function() {
$('#example').dataTable( {
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bProcessing": false,
"iDisplayLength": 30,
"bServerSide": true,
"sAjaxSource": "data_table_includes/customer_table.php",
"aoColumns":[
{ "sName": "customer_number" },
{ "sName": "customer_name" },
{ "sName": "email" },
{ "sName": "phone" }
],
"fnDrawCallback": function( oSettings ) {
$('#example tbody tr').click( function() {
var iPos = oTable.fnGetPosition( this );
alert( oSettings.aoData[iPos]._aData[0] );
window.location = "whatever.php?id="+oSettings.aoData[iPos]._aData[0];
} );
}
} );
} );
[/code]
This discussion has been closed.
Replies
[code]
var oTable;
$(document).ready( function () {
oTable = $('#customers').dataTable( {
"bJQueryUI": true,
"aaSorting": [[ 1, "desc" ]],
"sPaginationType": "full_numbers",
"bProcessing": false,
"iDisplayLength": <?php echo $number_to_display; ?>,
"bServerSide": true,
"sAjaxSource": "data_table_includes/customer_table.php",
/* "bStateSave": true, */
"aoColumns": [
{ "bVisible": false },
null,
null,
null,
null
],
"fnDrawCallback": function ( oSettings ) {
$('#customers tbody tr').each( function () {
var iPos = oTable.fnGetPosition( this );
$(this).click( function () {
window.location = "index.php?page=view_stations&customer_number="+oSettings.aoData[iPos]._aData[1];
} );
} );
}
} );
} );
[/code]