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.
and the html/php displaying the table is as follows :
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.
<script> $(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", } ] } } ); }); </script>
and the html/php displaying the table is as follows :
<div class="table"> <table class="display" id="PayMasterResults"> <thead> <tr> <th class="" width="600px"><b>Entry Description</b></th> <th class=""><b>Entry Timestamp</b></th> <th class=""><b>Debit/Credit</b></th> <th class=""><b>Running Balance</b></th> </tr> </thead> <tbody> '; for($x=0; $x<$xmldata->Ledger->count(); $x++) { echo ' <tr class="gradeB"> <td><a href="#" onclick="loadPMLedgerDetail(\''.$xmldata->Ledger[$x]->attributes()->ID.'\',\''.$_POST['ID'].'\');">'.$xmldata->Ledger[$x]->Description.'</a></td> <td>'.$xmldata->Ledger[$x]->Stamp.'</td> <Td>'.$xmldata->Ledger[$x]->Amount.'</td> <td>'.$xmldata->Ledger[$x]->Balance.'</td> </tr> '; } echo ' </tbody> </table> </div> <!-- End Table -->
I'm really stuck :(