Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82031

Setting sortable with aoColumnDefs glitched

$
0
0
Is it me, or the issue discussed here has returned (I'm using 1.9.4)? http://datatables.net/forums/discussion/5472/sort-classes-not-getting-reset-after-disabling-and-enabling-with-aocolumndefs-bug-plus-patch/p1

Summary:
- disabling sorting on all columns with matching aoColumnDefs on "_all"
- enabling it on the ones with matching on a css class, e.g. "sortable"

Script:
<script type="text/javascript">
  $(function () {
    var oOptions = {
      aoColumnDefs: [
        { aTargets: [ 'searchable' ], bSearchable: true },
        { aTargets: [ 'sortable' ], bSortable: true },
        { aTargets: [ '_all' ], bSortable: false, bSearchable: false }
      ]
    };

    $('#table').dataTable(oOptions);
  });
</script>

Markup:
<table id="table" class="datatable">
  <thead>
  <tr>
    <th>Header 1</th>
    <th class="sortable">Header 2</th>
    <th class="sortable">Header 3</th>
    <th>Header 4</th>
  </tr>
  </thead>
</table>

This does result in the expected columns correctly being sortable and not sortable with the click events. However, all columns get assigned the wrong css class "sorting_disabled".

Edit: moved it to "Bug reports"

Viewing all articles
Browse latest Browse all 82031

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>