TypeError:oColumn未定义使用jQuery数据库时 [英] TypeError: oColumn is undefined When Using jQuery Datatables Library

查看:213
本文介绍了TypeError:oColumn未定义使用jQuery数据库时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Joomla网站表上正确使用jQuery Datatables库出现问题。
http://datatables.net

I am having a problem getting the jQuery Datatables library to show up properly on my Joomla website table. http://datatables.net

脚本是我的桌子一半的样式,然后放弃(我得到表头颜色改变和文本颜色,但没有数据表控件等)。

The script is half styling my table and then giving up (I am getting the table header colour changed and text colour, but no datatables controls etc).

Firebug也是抛出以下错误:

Firebug is also throwing the following error:

 TypeError: oColumn is undefined

在我的Joomla模板index.php中,我在< head> 中有以下内容:

In my Joomla templates index.php I have the following in the <head>:

<script src="./datatables/js/jquery.js" type="text/javascript"></script>
<script src="./datatables/js/jquery.dataTables.js" type="text/javascript"></script>
<script type="text/javascript"> 
    jQuery.noConflict();                
    jQuery(document).ready(function() {
    jQuery('#staff_table').dataTable({
        "bLengthChange": true,
        "bFilter": true,
        "bSort": true,
        "bInfo": true,
        "bAutoWidth": true
        } );
    } );
</script>

HTML / PHP如下所示:

The HTML / PHP looks like this:

<h3>Members of Staff</h3>
<p>If you're looking for a member of staff at Tower Road Academy, you'll find their details here.</p>
<table class="staff_table" id="staff_table">
    <tr class="staff_table_head">
        <th>Name</th>
        <th>Job Title</th>
        <th>Email Address</th>
    </tr>

    <?php
        $result = mysql_query("SELECT * FROM itsnb_chronoforms_data_addstaffmember");

        while($row = mysql_fetch_array($result))
        { 
        echo '<tr>';  
        echo '<td>' . $row['staff_name'] . '</td><td>' . $row['staff_job'] . '</td><td><a     href=mailto:"' . $row['staff_email'] . '">' . $row['staff_email'] . '</a>' . '</td>';
        echo '</tr>';
        }
    ?>
</table>


推荐答案

要使datatable正常工作,使用适当的< thead> < tbody> 标签。

For datatable to work properly, your tables must be constructed with a proper <thead> and <tbody> tags.


HTML中的所有DataTable需求是一个很好的形式(即有效的HTML),一个标题(由HTML标签定义)和一个主体(一个标签)

All DataTables needs in your HTML is a which is well formed (i.e. valid HTML), with a header (defined by a HTML tag) and a body (a tag)

可数据文档

这篇关于TypeError:oColumn未定义使用jQuery数据库时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆