你能告诉我为什么会出现这个错误吗?JTable Uncaught TypeError: Cannot call method 'data' of undefined
Ajax工作,我得到了一个有效的响应,但它不取,并显示在表
你能帮我吗?另一方面,如果我脚本我把它放在单独的文件我怎么能调用这个?
<div id="church_list" style="width: 600px;"></div>
<script type="text/javascript">
$(document).ready(function () {
//Prepare jTable
$('#church_list').jtable({
title: 'Church List',
paging: true,
pageSize: 20,
sorting: true,
defaultSorting: 'church_name ASC',
actions: {
listAction: server_path+'/superadmin/?a=listChurch'
},
fields: {
church_name: {
title: 'Church Name',
width: '30%'
},
church_city: {
title: 'Church City',
width: '20%'
},
church_state: {
title: 'Church State',
width: '20%'
},
payment_type: {
title: 'Payment Type',
width: '20%'
},
training_cost: {
title: 'Training Cost',
width: '20%'
}
}
});
//Load person list from server
$('#church_list').jtable('load');
});
</script>
1)您可能正在使用旧版本的jquery -特别是如果您正在使用下载附带的代码。我有一个类似的现成的程序,然后换了一个新版本,问题就解决了,没有做任何其他的改变。
https://github.com/hikalkan/jtable/issues/9532)你没有一个ID/主键-我已经能够添加它,而不做任何jquery更改和表将呈现
我不知道这个问题是否解决了,但我提醒一下:
listAction是一个对象
像这样修改代码:
listAction:{
method: *your URL*
}