My dataTables table of 600 chess games was too slow. I was using php to write out the table data. I instead used ajax and it renders much faster now.
I want to make a row clickable based on "game" and hide the "game" field.
MY JSON STRUCTURE:
{
"game": "5581",
"Date": "12/18/2010",
"Event": "RCC Saturday Open",
"ECO": "C00",
"White": "Nikolayev, Igor (FM)",
"WhiteElo": "2380",
"Black": "Spencer, Douglas",
"BlackElo": "1902",
"Result": "1-0"
},
MY JAVASCRIPT:
<script>
$(document).ready(function() {
$('#cccr').DataTable( {
"createdRow": function(row, data, index) {$(row).attr('game', data.game);},
"deferRender": true,
"oSearch": {"sSearch": "<?php echo ($_GET['player']); ?>"},
"aaSorting": [],
"bPaginate": false,
"bLengthChange": true,
"bFilter": true,
"bSort": true,
"bInfo": true,
"sPaginationType": "full_numbers",
"sScrollY": "25rem",
"responsive": true,
"bAutoWidth":true,
"autoWidth": true,
"ajax": "games.ajax",
"columns": [
{ "data": "Date" },
{ "data": "Event" },
{ "data": "ECO" },
{ "data": "White" },
{ "data": "WhiteElo" },
{ "data": "Black" },
{ "data": "BlackElo" },
{ "data": "Result" },
{ "data": "game", visible : false }
]
} );
$("#cccr").on('click', 'tr', function() {
alert('basic.php?game='+$(this).attr('game'));
} );
</script>
Some kind coder showed me how to make the "game" field clickable. But I want to hide the game field and make the entire row clickable as in:
basic.php?game=5579