对表中的表进行排序

时间:2011-03-09 21:23:02

标签: jquery sorting html-table tablesorter

我是一个大表中的几个表,我使用jquery tablesorter来对主表进行排序。

我希望能够对主表中的各个表进行排序。示例代码:

 <table class="info tablesorter" border="0" cellspacing="0" cellpadding="0">
            <thead>
                <tr>

                    <th colspan>The Name</th>
                    <th>Geography</th>
                    <th colspan="5">Prospective clients</th>

                </tr>
            </thead>
            <tbody>

                        <Tr class="parent" id="id_1" style='background-color: white'>

                        <TD style=vertical-align:middle>Main echo 1</td>
                        <TD style=vertical-align:middle>New York, NY</td>
                        <td colspan="5">55</td>
                        </tr>
                        <tr class="child-id_1 expand-child" style="display:none">
                        <td colspan='7'>
                        <table class="ctable_1 ts2" width=75% id="class_id_1">

                        <thead><tr>
                            <th>URL</th>
                            <th>Contact Page</th>
                            <th>Phone</th>
                            <th>GoogleIndex</th>
                            <th>Listed in next?</th>
                            <th>Created On</th>
                        </tr></thead>
                        <tbody>
                        <tr class='childofmarket'>
                            <td> xyz </td>
                            <td> aaa</td>
                            <td> ###-###-#### </td>
                            <td>127</td>
                            <td>- No -</td>
                            <td>03-09-2011</td>
                        </tr>
                        <tr class='childofmarket'>
                            <td> aak</td>
                            <td>csa</td>

                            <td>##########</td>
                            <td>69</td>
                            <td>- No -</td>
                            <td>03-09-2011</td>
                        </tr>

等等。

  

错误:解析器[i]未定义

有谁能告诉我我需要解决的问题?

1 个答案:

答案 0 :(得分:0)

不知道你是否尝试了但是给你所有的表提供了相同的IE类。 sorted_table

请说出您正在使用哪种表格,我更喜欢这个Tablesorter

这在javascript中使用类似

的内容
$(document).ready(function()
{
     $('.sorted_table').tablesorter();
});