dataTables.net onload scroll to bottom of table - how? no method i've tried works
dataTables.net onload scroll to bottom of table - how? no method i've tried works
I am loading up a ledger page and utilisng the dataTables function (whcih i've used throughout my site) however I need the ledger which could have thousands of rows to scroll immediately to the bottom which shows the newest record.
I am not able to sort by descending as that is not how a ledger works, I could use pagination but could not work out how to execute 'last page' automatically.
I have tried a few variations of scrollTop but nothign seems to work. My data is loaded from a php array.
[code]
$(document).ready(function() {
$("#PayMasterResults").dataTable( {
"sPaginationType": "full_numbers",
"bPaginate": false,
"bJQueryUI" : true,
"sScrollY": "215",
"bLengthChange": true,
"bFilter": true,
"bSort": false,
"bInfo": true,
"bAutoWidth": false,
"sDom": \'<"H"lTfr>t<"F"ip>\',
"oTableTools": {
"sSwfPath": "lib/copy_csv_xls_pdf.swf",
"sRowSelect": "multi",
"aButtons": [
"print",
{
"sExtends": "copy",
"sButtonText": "Copy to clipboard"
},
{
"sExtends": "csv",
"sButtonText": "Export CSV"
},
{
"sExtends": "xls",
"sButtonText": "Save for Excel"
},
{
"sExtends": "pdf",
"sButtonText": "Save to PDF",
"sPdfOrientation": "landscape",
}
]
}
} );
});
[/code]
and the html/php displaying the table is as follows :
[code]
Entry Description
Entry Timestamp
Debit/Credit
Running Balance
';
for($x=0; $x<$xmldata->Ledger->count(); $x++) {
echo '
'.$xmldata->Ledger[$x]->Description.'
'.$xmldata->Ledger[$x]->Stamp.'
'.$xmldata->Ledger[$x]->Amount.'
'.$xmldata->Ledger[$x]->Balance.'
';
}
echo '
<!-- End Table -->
[/code]
I'm really stuck :(
I am not able to sort by descending as that is not how a ledger works, I could use pagination but could not work out how to execute 'last page' automatically.
I have tried a few variations of scrollTop but nothign seems to work. My data is loaded from a php array.
[code]
$(document).ready(function() {
$("#PayMasterResults").dataTable( {
"sPaginationType": "full_numbers",
"bPaginate": false,
"bJQueryUI" : true,
"sScrollY": "215",
"bLengthChange": true,
"bFilter": true,
"bSort": false,
"bInfo": true,
"bAutoWidth": false,
"sDom": \'<"H"lTfr>t<"F"ip>\',
"oTableTools": {
"sSwfPath": "lib/copy_csv_xls_pdf.swf",
"sRowSelect": "multi",
"aButtons": [
"print",
{
"sExtends": "copy",
"sButtonText": "Copy to clipboard"
},
{
"sExtends": "csv",
"sButtonText": "Export CSV"
},
{
"sExtends": "xls",
"sButtonText": "Save for Excel"
},
{
"sExtends": "pdf",
"sButtonText": "Save to PDF",
"sPdfOrientation": "landscape",
}
]
}
} );
});
[/code]
and the html/php displaying the table is as follows :
[code]
Entry Description
Entry Timestamp
Debit/Credit
Running Balance
';
for($x=0; $x<$xmldata->Ledger->count(); $x++) {
echo '
'.$xmldata->Ledger[$x]->Description.'
'.$xmldata->Ledger[$x]->Stamp.'
'.$xmldata->Ledger[$x]->Amount.'
'.$xmldata->Ledger[$x]->Balance.'
';
}
echo '
<!-- End Table -->
[/code]
I'm really stuck :(
This discussion has been closed.
Replies