我在做 table
HTML 标签
<table id="example" class="display" onload="callData()"></table>
JavaScript
function dataIsSet(){
var dataSet=[];
syncAjaxCall("POST","getGridData" ,"", "application/json")
.done(
function(data) {
if(data.response.Status==1){
for(i=0;i<data.response.Result.length; i++){
dataSet.push([])
}
for(i=0;i<data.response.Result.length; i++){
dataSet[i].push(data.response.Result[i].interestsName);
dataSet[i].push(data.response.Result[i].subscriberCount);
dataSet[i].push(data.response.Result[i].messageCount);
}
}
else
showMessage("green", data.response.Description, "");
});
if (dataSet[0].length==3)
return dataSet;
}
function callData() {
debugger;
$('#example').DataTable( {
data: dataIsSet(),
columns: [
{ title: "Interest Name" },
{ title: "No of Subscribers" },
{ title: "No of Messages" }
] ,
} );
}
我的javascript文件
<script src="interests/js/jquery-1.12.0.min.js" type="text/javascript"> </script>
<script src="interests/js/jquery.dataTables.min.js" type="text/javascript"></script>
我的CSS文件
<link rel="stylesheet" type="text/css" href="interests/css/jquery.dataTables.min.css"/>
现在我想拒绝。消息列的链接,它将从兴趣名称中获取值(value)。
最佳答案
只需将它们插入 PutItHeretag 好友即可。
关于javascript - 如何使数据表列可点击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36591494/