dynatable ajax排序不起作用

时间:2014-11-13 14:33:13

标签: jquery ajax json dynatable

使用Ajax从JSON构建表时,排序不起作用。它处于活动状态,而asc / desc符号会发生变化,但没有任何明显的变化。怎么了?

我已添加以下示例。

这是JSON文件

{
  "kennis": [
    {
      "kennisartikel": "Marcel Doesburg",
      "cascade": "CINI01\Internet\2 FMI Phase\PBI\Tridion Manual training April 2012.doc",
      "link": "<a href=''>OPEN</a>",
      "tags": "bla,bla"
    },
    {
      "kennisartikel": "Fredwin",
      "cascade": "CINI01\Internet\2 FMI Phase\PBI\Tridion Manual training April 2012.doc",
      "link": "<a href=''>OPEN</a>",
      "tags": "bla,bla"
    },
    {
      "kennisartikel": "Jantje H",
      "cascade": "CINI01\Internet\2 FMI Phase\PBI\Tridion Manual training April 2012.doc",
      "link": "<a href=''>OPEN</a>",
      "tags": "bla,bla"
    }
  ],
  "queryRecordCount": 4,
  "totalRecordCount": 4
}

这是我的HTML

   <table id="kennistabel" class="tablesorter">
        <thead>
            <tr>
                <th width="33%" data-dynatable-column="kennisartikel" data-dynatable-sorts="kennisartikel" class="dynatable-head" data-dynatable-default-sort="true">Kennisartikel</th>                 
                <th width="40%" data-dynatable-column="cascade" data-dynatable-no-sort="true">Cascade</th>
                <th width="7%" data-dynatable-column="link" data-dynatable-no-sort="true">Link</th>
                <th width="20%" data-dynatable-column="tags" data-dynatable-no-sort="true">Tags</th>
            </tr>
        </thead>
        <tbody id="kennisbank">             
        </tbody>

</table>

这是Javascript

$(document).ready(function () {
    $("#kennistabel").dynatable({
        dataset: {
            ajax: true,
            ajaxUrl: '//www.tourdejunior.nl/kennisbank/cskennisbank.json',
            ajaxOnLoad: true,           
            records: []
        },
        features: {
            paginate: false,
            search: false,
            recordCount: false,
            sort: true,
            pushState: false,
            perPageSelect: false
        }   
    });
});

1 个答案:

答案 0 :(得分:0)

有点晚了,但有同样的问题...尝试他们在自己的民主中使用的js文件:https://s3.amazonaws.com/dynatable-docs-assets/js/jquery.dynatable.js