我是 jQuery DataTables api 的新手,我使用 jQuery Datatables API 在我的表中添加了一行。但是,为什么该部分不显示?我需要做什么才能让它显示我添加到表中的每一行?
谢谢你的帮助!
<table width='200px' style="table-layout: fixed" id="downlink-table-nameserver" border>
<thead>
<td>Server Port WWN</td>
<td>Server Node Name</td>
<td>Server Port Name</td>
<td>Server Node Name</td>
</thead>
<tbody>
<tr>
<td>
<label for="connection-state"> Connection State </label>
<div id="connection-state"></div>
</td>
</tr>
</tbody>
</table>
Javascript:
$(document).ready(function() {
//$('#example').dataTable();
var serverPortWwnTitle = 'Server Port WWN',
serverNodeWwnTitle = 'Server Node WWN',
serverPortNameTitle = 'Server Port Name',
serverNodeNameTitle = 'Server Node Name';
var linkOptions = {
"bPaginate" : false,
"bFilter" : false,
"bInfo" : false,
"bAutoWidth" : false,
"aaData" : [],
"aaSorting": [[ 1, "alphanumeric-asc" ]],
"aoColumns" : [
{
"sTitle" : serverPortWwnTitle,
"sWidth" : "230px",
"mDataProp" : "serverPortWwn",
"sType" : "string"
}, {
"sTitle" : serverNodeWwnTitle,
"sWidth" : "230px",
"mDataProp" : "serverNodeWwn",
"sType" : "string"
}, {
"sTitle" : serverPortNameTitle,
"sWidth" : "230px",
"mDataProp" : "serverPortName",
"sType" : "string"
}, {
"sTitle" : serverNodeNameTitle,
"sWidth" : "230px",
"mDataProp" : "serverNodeName",
"sType" : "string"
}
]
};
var nameSvrTable = $('#downlink-table-nameserver').dataTable(linkOptions);
var connMapInfo = [];
connMapInfo.push({
serverPortWwn: "portwwn",
serverNodeWwn : "nodewwn",
serverPortName: "portname",
serverNodeName: "nodename"
});
nameSvrTable.fnClearTable();
nameSvrTable.fnAddData(connMapInfo);
} );