dquh37673 2015-03-27 11:03
浏览 25

数据表排序PHP,缺少分页按钮

I was trying so hard to solve this problem, but it really make my mind explode.

Everything displays nicely including the paging,listing and the date are sorted by asc (Default)

After I added in Java script(make it sort by desc) This is javascript:

<script type='text/javascript' src='../js/jquery.js'></script>
<script type='text/javascript'>

jQuery(document).ready(function(j)
{
        $('#example').dataTable({
        'aaSorting': [[0,'desc']]      //Sorts 1st column asc
        })
});
</script>

Data listing sorted, everything is still cool, but the paging buttons are missing, left "Showing X to X of X entries"

Please Help!

Here is my script added this at the bottom of the script import datatable js

<script type='text/javascript' src='assets/plugins/datatables/jquery.dataTables.min.js'></script>
<script type='text/javascript' src='assets/plugins/datatables/dataTables.bootstrap.js'></script>
<script type='text/javascript' src='assets/demo/demo-datatables.js'></script>

Table script:

<table cellpadding="0" cellspacing="0" border="0" class="stdtable stdtablecb datatables" id="example">
            <thead>
                <tr>
                    <th>'.__("Date").'</th>
                    <th>'.__("Description").'</th>
                    <th>'.__("Credit").'</th>
                    <th>'.__("Debit").'</th>
                    <th>'.__("Balance").'</th>
                </tr>
            </thead>
        <tbody>
            '.$his_row.'
        </tbody>
        </table>

////////////////////////////

for($i=0;$i<$this_page_total;$i++){

 $p=mysql_fetch_assoc($r);

 $his_row.='
    <tr class="'.($k==0?'even':'odd').'">
        <td class="center">'.$p["cdate"].'</td>
        <td>'.$p["descr"].'</td>
        <td>'.number_format(in_array($p['type'],array('c','credit'))? $p['amount'] : 0, 2).'</td>
        <td>'.number_format(!in_array($p['type'],array('c','credit'))? $p['amount'] : 0, 2).'</td>
        <td class="center">'.nl2br($p["bal"]).'</td>
    </tr>
 ';

 $k=1-$k;

}

Here are the link for my datatables (Sorry for I cant post any image here due to low reputation) This is the datatable that sort by default(ASC) https://www.dropbox.com/s/fj8lqj766o4vgeb/Screenshot%202015-03-27%2018.33.52.png?dl=0

This is the datatable that after insert javascript sort by desc https://www.dropbox.com/s/pphc70cp7ntyty8/Screenshot%202015-03-27%2018.34.34.png?dl=0

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 delta降尺度计算的一些细节,有偿
    • ¥15 Arduino红外遥控代码有问题
    • ¥15 数值计算离散正交多项式
    • ¥30 数值计算均差系数编程
    • ¥15 redis-full-check比较 两个集群的数据出错
    • ¥15 Matlab编程问题
    • ¥15 训练的多模态特征融合模型准确度很低怎么办
    • ¥15 kylin启动报错log4j类冲突
    • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
    • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序