# 8 examples of 'datatable sorting false' in JavaScript

Every line of 'datatable sorting false' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

## All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
``132public get isSorting() { return this.header &amp;&amp; this.header.colSorting; }``
``149_isSorting(columnIndex, sortColumn) {150  return columnIndex === sortColumn;151}``
``90function quickSort(left, right) {91  if (left &lt; right) {92    // QuickSort's effectiveness depends on its ability to partition the93    // sequence being sorted into two subsequences of roughly equal length:94    // by halving the length at each recursion level, the subproblems get95    // smaller faster. To get a good partition, we must choose a pivot value96    // that is close to the median of the values in the sequence: by97    // definition, half of the values will fall before the median, half98    // after it.99    // If the sequence is already mostly sorted, then choosing the first or100    // last value as the pivot is probably as far from the median as you101    // could possibly get; this is a "pessimal", not optimal, choice.102    // Choosing the middle value as the pivot is likely to be much closer to103    // the median.104    const pivot = (left + right) &gt;&gt; 1;105    const partitionIndex = partition(pivot, left, right);106107    // Sort left and right108    quickSort(left, partitionIndex - 1);109    quickSort(partitionIndex + 1, right);110  }111}``
``57isSortAsc() {58  return this.currentSorting.dir === 1;59}``
``128setSorting(sorting: DataSorting): void {129    this._sorting = sorting;130131    if (sorting &amp;&amp; sorting.key) {132        this._rows.sort((a: DataRow, b: DataRow) =&gt; {133            let left = a.getValue(sorting.key);134            if (left) {135                left = (left instanceof Date) ? left.valueOf().toString() : left.toString();136            } else {137                left = '';138            }139140            let right = b.getValue(sorting.key);141            if (right) {142                right = (right instanceof Date) ? right.valueOf().toString() : right.toString();143            } else {144                right = '';145            }146147            return sorting.direction === 'asc'148                ? left.localeCompare(right)149                : right.localeCompare(left);150        });151    }152}``
``25isSorting(field) {26    return this.\$scope.sortField() === this.getSortName(field);27}``
``363private sortRows(rows: Row[]): Row[] {364  if (!this.sortingSettings.length) {365    return rows;366  }367368  let sortings = this.sortingSettings.slice();369  return rows.slice().sort((a, b) =&gt; {370    let res;371    for (let i = 0, len = sortings.length; i &lt; len; i++) {372      let s = sortings[i];373      let accessor = functor(s.accessor);374      res = s.comparer(accessor(a), accessor(b));375      if (res !== 0) return res;376    }377    return res;378  });379}``
``41sortData(data: any[], sortBy: string, sortOrder: TdDataTableSortingOrder = TdDataTableSortingOrder.Ascending): any[] {42  if (sortBy) {43    data = Array.from(data); // Change the array reference to trigger OnPush and not mutate original array44    data.sort((a: any, b: any) =&gt; {45      const compA: any = a[sortBy];46      const compB: any = b[sortBy];47      let direction: number = 0;48      if (!Number.isNaN(Number.parseFloat(compA)) &amp;&amp; !Number.isNaN(Number.parseFloat(compB))) {49        direction = Number.parseFloat(compA) - Number.parseFloat(compB);50      } else {51        if (compA &lt; compB) {52          direction = -1;53        } else if (compA &gt; compB) {54          direction = 1;55        }56      }57      return direction * (sortOrder === TdDataTableSortingOrder.Descending ? -1 : 1);58    });59  }60  return data;61}``