【发布时间】:2017-02-28 19:36:26
【问题描述】:
我在我的 GridView 中使用响应式 DataTable 类。
<asp:GridView ID="myGrid" runat="server" EnableViewState="False"
CssClass="table table-striped table-bordered table-hover">
<Columns>
<asp:CommandField ShowEditButton="true" CausesValidation="true" />
使用下面的脚本:
<script>
$(document).ready(function () {
$("#<%= myGrid.ClientID %>").DataTable({
responsive: true,
"columnDefs": [{ "orderable": false, "targets": ['_all'] }],
});
});
</script>
此脚本禁用除我的第一列之外的所有列的排序选项,第一列具有使用 GridView 的ShowEditButton="true" 启用的编辑按钮。
我可以在页面中看到呈现的 HTML,第一列仍然有 class="sorting_asc",而所有其他列都有 class="sorting_disabled"。如何禁用 GridView 为编辑/更新/取消添加的列的排序?
【问题讨论】:
标签: jquery asp.net twitter-bootstrap responsive-design datatables