1

Here is my table : https://codepen.io/anon/pen/dzjPro I wan't to sort only first 2 columns, the column Position was not sortable.

Code :

$scope.dataTableOpt = {

  "aLengthMenu": [[10, 50, 100,-1], [10, 50, 100,'All']],
  "aoSearchCols": [
      null
    ],
  };

This doesn't work :

 $scope.dataTableOpt = {

      "aLengthMenu": [[10, 50, 100,-1], [10, 50, 100,'All']],
      "aoSearchCols": [
          null
        ],
      "aoColumnDefs": [
            { "aDataSort": [ 0,1 ], "aTargets": [ 0,1 ] }
        ],
      };

Thanks for answers in advance.

1 Answer 1

1

Seems to me you have picked up some sunsetted legacy code. Use columnDefs and orderable instead :

$scope.dataTableOpt = {
  lengthMenu: [[10, 50, 100,-1], [10, 50, 100,'All']],
  columnDefs: [
    { targets: 2, orderable: false }
  ]
};

targets is the zero based column index. It can be an array of indexes.

Also take a look at angular datatables directives. You may face problems with rendering and so on, if you use "pure" jQuery datatables along with angular.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.