我正在尝试使用Dynatable加载json数据看起来不错,但无法排序,问题是什么?
这是我的JavaScript:
$(document).ready(function() {
var dynatable = $('table').dynatable({
dataset: {
ajax: true,
ajaxOnLoad: true,
ajaxUrl: 'people.json',
records: [],
perPageDefault: 4,
perPageOptions: [4,6,8,10]
},
params: {
records: 'People'
}
}).data("dynatable");
});
表格:
<table>
<thead>
<tr>
<th>NAME</th>
<th>ADDRESS</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
答案 0 :(得分:1)
将您的表格html标记更改为
<table id="myTable">
将您的javascript更改为:
$(document).ready(function() {
$('#myTable').dynatable({
dataset: {
ajax: true,
ajaxOnLoad: true,
ajaxUrl: 'people.json',
records: [],
perPageDefault: 4,
perPageOptions: [4,6,8,10]
},
params: {
records: 'People'
}
});
});