我试图从jQuery数据表中的某些列中删除排序,但无法让它消失。我正在使用转发器来填充表。我设置可订购,可排序和可搜索为假的两列我试图删除排序但它仍然显示排序箭头。
<asp:Repeater runat="server" ID="rptTableData" OnItemCommand="rptTableData_ItemCommand">
<HeaderTemplate>
<div id="divFCTable">
<table id="fcTable" class="table table-striped table-bordered table-hover">
<thead>
<tr class="info">
<th></th>
<th>Certificate</th>
<th>Response Due Date</th>
<th>Frequency</th>
<th>Question</th>
<th>Requires Attachment</th>
</tr>
</thead>
<tbody>
</HeaderTemplate>
<FooterTemplate>
</tbody>
<tfooter>
<tr class="info">
<th></th>
<th>Certificate</th>
<th>Response Due Date</th>
<th>Frequency</th>
<th>Question</th>
<th>Requires Attachment</th>
</tr>
</tfooter>
</table>
</div>
</FooterTemplate>
<ItemTemplate>
<tr>
<td>
<asp:LinkButton runat="server" ID="lbDetails" CommandArgument='<%= Eval("CertItemName") %>' Text="Respond" />
</td>
<td runat="server" id="tdCertItemName"><%# Eval("CertItemName") %></td>
<td runat="server" id="tdResponseDueDate"><%# Eval("ResponseDueDate", "{0:MM/dd/yyyy}") %></td>
<td runat="server" id="tdFrequency"><%# Eval("Frequency") %></td>
<td runat="server" id="tdQuestionText"><%# Eval("QuestionText") %></td>
<td runat="server" id="tdRequireAttachment"><%# Convert.ToBoolean(Eval("RequireAttachment")) ? "Yes" : "No" %></td>
</tr>
</ItemTemplate>
</asp:Repeater>
<script>
$(document).ready(function () {
table = $('#fcTable').DataTable({
"lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
order: [[2, "asc"], [1, "asc"]],
"columnDefs": [
{ "sortable": false, "targets": [0,4] },
{ "orderable": false, "targets": [0,4] },
{ "searchable": false, "targets": [0,4] }
],
select: true,
processing: true,
"pageLength": 10,
"rowCallback": function (row, data, index) {
if (moment(new Date()).isAfter(data[2], 'day')) {
var $cell = $('td:eq(2)', row);
$cell.css('color', 'red');
$cell.attr('title', 'Overdue Response Submission');
}
}
});
})
</script>