Returns new columns sorted in sortColumn order.
543807
function getSortedColumns(tableStructure, sortColumn, compareFunction) {
  // With help from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort
  var mappedArray = sortColumn.julianDatesOrValues.map(function(value, i) {
    return { index: i, value: value };
  });
  if (!defined(compareFunction)) {
    if (sortColumn.type === VarType.TIME) {
      compareFunction = function(a, b) {
        if (defined(a) && defined(b)) {
          return JulianDate.compare(a, b);
        }
        return defined(a) ? -1 : defined(b) ? 1 : 0; // so that undefined > defined, ie. all undefined dates go to the end.
      };
    } else {
      compareFunction = function(a, b) {
        return +(a > b) || +(a === b) - 1;
      };
    }
  }
  mappedArray.sort(function(a, b) {
    return compareFunction(a.value, b.value);
  });
  return tableStructure.columns.map(column => {
    var sortedValues = mappedArray.map(element => column.values[element.index]);
    return new TableColumn(column.name, sortedValues, column.getFullOptions());
  });
}
121735
public void setSortColumns(java.util.Collection<Order> sortColumns) {
        if (sortColumns == null) {
            this.sortColumns = null;
            return;
        }

        this.sortColumns = new java.util.ArrayList<Order>(sortColumns);
    }
912115
function ObjectSort(array, columns, order)
{
	//Check the columns
	if(typeof columns === 'undefined')
	{
		//Create the columns array
		var columns = [];

		//Add the keys
		for(var key in array[0]){ columns.push(key); }
	}

	//Check if columns is not an array
	else if(Array.isArray(columns) === false)
	{
		//Convert it to array
		columns = [columns];
	}

	//Check the order
	if(typeof order === 'undefined')
	{
		//Create the order array
		var order = [];

		//Add ASC order
		for(var i = 0; i < columns.length; i++){ order.push('ASC'); }
	}

	//Check if order is not an array
	else if(Array.isArray(order) === false)
	{
		//Convert it to array
		order = [order];
	}

	//Else, check for lowercase
	else
	{
		//Add the order to uppercase
		for(var i = 0; i < order.length; i++){ order[i] = order[i].toUpperCase(); }
	}

	//Check the order array length
	if(order.length < columns.length)
	{
		//Complete the order array
		for(var i = order.length; i < columns.length; i++){ order.push('ASC'); }
	}

	//Sort the array
	array.sort(function(left, right){ return Compare(left, right, columns, order); });

	//Return the array
	return array;
}
906509
function standardizeCols(columns) {

	/**
	 * Gets the default column name
	 */
	function getDefaultFormatter(colName) {
		return function(o) {
			return o[colName];
		};
	}

	/**
	 * Gets the default column sorter
	 */
	function getDefaultSorter(colName) {
		return function(a, b, dir){

			var 
				firstRec = dir == 'asc' ? a : b,
				secondRec = dir == 'asc' ? b : a,

				fA = firstRec[colName].toLowerCase(),
				fB = secondRec[colName].toLowerCase();

			// Handle numbers
			if (fA<fB) return -1
			if (fA>fB) return +1
			return 0
		};
	}


	for (var i in columns) {
		var column = columns[i];

		if (typeof column == "string") {
			column = {name: column};
		}

		column.dir = column.sortDir || 'asc';
		column.formatter = column.formatter || getDefaultFormatter(column.key || column.name);
		column.sorter = column.sorter || getDefaultSorter(column.key || column.name);

		columns[i] = column;
	}
	return columns;
}
1287933
private ColumnDefinition[] columnDefinitions(ColumnDefinition[] columns, String[] order)
   {
      Map<String, ColumnDefinition> map = makeColumnMap(columns);
      ColumnDefinition[] result = new ColumnDefinition[order.length];
      for (int index = 0; index < order.length; index++)
      {
         result[index] = map.get(order[index]);
      }
      return result;
   }
989500
public Table sortOn(String... columnNames) {

        Sort key = null;
        List<String> names = columnNames().stream().map(String::toUpperCase).collect(toList());

        for (String columnName : columnNames) {
            Sort.Order order = Sort.Order.ASCEND;
            if (!names.contains(columnName.toUpperCase())) {
                // the column name has been annotated with a prefix.
                // get the prefix which could be - or +
                String prefix = columnName.substring(0, 1);

                // remove - prefix so provided name matches actual column name
                columnName = columnName.substring(1, columnName.length());

                order = getOrder(prefix);
            }

            if (key == null) { // key will be null the first time through
                key = first(columnName, order);
            } else {
                key.next(columnName, order);
            }
        }
        return sortOn(key);
    }
239893
def get_changed_columns(self):
        
        return [k for k, v in self._values.items() if v.changed]
1139154
protected function sortColumns()
    {
        $this->config->getColumns()->sort(function (FieldConfig $a, FieldConfig $b) {
            return $a->getOrder() > $b->getOrder();
        });
    }
769306
public function sort(array $sorted_columns): self
    {
        $diff = array_diff_assoc($sorted_columns, array_unique($sorted_columns));
        if (count($diff) > 0) {
            $cols = implode(',', $diff);
            throw new Exception\DuplicateColumnException(__METHOD__ . " Duplicate column found in paramter sorted_columns : '$cols'");
        }
        $columns = [];

        foreach ($sorted_columns as $idx => $column) {
            if (!$this->exists($column)) {
                throw new Exception\InvalidArgumentException(__METHOD__ . " Column '$column' does not exists.");
            }
            $columns[$column] = $this->get($column);
        }
        // Appending eventual non sorted columns at the end
        $columns = array_merge($columns, (array) $this->columns);
        $this->columns->exchangeArray($columns);

        return $this;
    }
1338356
public function getSortColumns()
    {
        if ($this->_aSortColumns === null) {
            $this->setSortColumns(\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aSortCols'));
        }

        return $this->_aSortColumns;
    }
186420
public function get_sort_columns() {
        if (!$this->setup) {
            throw new coding_exception('Cannot call get_sort_columns until you have called setup.');
        }

        if (empty($this->prefs['sortby'])) {
            return array();
        }

        foreach ($this->prefs['sortby'] as $column => $notused) {
            if (isset($this->columns[$column])) {
                continue; // This column is OK.
            }
            if (in_array($column, get_all_user_name_fields()) &&
                    isset($this->columns['fullname'])) {
                continue; // This column is OK.
            }
            // This column is not OK.
            unset($this->prefs['sortby'][$column]);
        }

        return $this->prefs['sortby'];
    }
98622
def __parseColumns(self):
        """"""
        columns = []
        if self.__dataItem.has_key('columnModel'):
            for column in self.__dataItem['columnModel']:
                columns.append(Column(column))
        return columns
857342
def sort(self, column, order=Qt.DescendingOrder):
        """"""
        if column == 0:
            self.breakpoints.sort(
                key=lambda breakpoint: breakpoint[1])
            self.breakpoints.sort(
                key=lambda breakpoint: osp.basename(breakpoint[0]))
        elif column == 1:
            pass
        elif column == 2:
            pass
        elif column == 3:
            pass
        self.reset()
949179
def _compare_columns(self, new_columns, old_columns):
        
        '''  '''
        
        # print(new_columns)
        # print(old_columns)
        
        add_columns = {}
        remove_columns = {}
        rename_columns = {}
        retype_columns = {}
        resize_columns = {}
        for key, value in new_columns.items():
            if key not in old_columns.keys():
                add_columns[key] = True
                if value[2]:
                    if value[2] in old_columns.keys():
                        rename_columns[key] = value[2]
                        del add_columns[key]
            else:
                if value[1] != old_columns[key][1]:
                    retype_columns[key] = value[1]
                if value[3] != old_columns[key][3]:
                    resize_columns[key] = value[3]
        remove_keys = set(old_columns.keys()) - set(new_columns.keys())
        if remove_keys:
            for key in list(remove_keys):
                remove_columns[key] = True
        
        return add_columns, remove_columns, rename_columns, retype_columns, resize_columns
1060415
def sort_data(data, cols):
    """"""
    return data.sort_values(cols)[cols + ['value']].reset_index(drop=True)
415376
def ReorderByColumn( self, column ):
        """"""
        # TODO: store current selection and re-select after sorting...
        single_column = self.SetNewOrder( column )
        self.reorder( single_column = True )
        self.Refresh()
598946
def sort(self, column, order=Qt.AscendingOrder):
        """"""
        reverse = (order==Qt.DescendingOrder)
        if column == 0:
            self.sizes = sort_against(self.sizes, self.keys, reverse)
            self.types = sort_against(self.types, self.keys, reverse)
            try:
                self.keys.sort(reverse=reverse)
            except:
                pass
        elif column == 1:
            self.keys[:self.rows_loaded] = sort_against(self.keys, self.types,
                                                        reverse)
            self.sizes = sort_against(self.sizes, self.types, reverse)
            try:
                self.types.sort(reverse=reverse)
            except:
                pass
        elif column == 2:
            self.keys[:self.rows_loaded] = sort_against(self.keys, self.sizes,
                                                        reverse)
            self.types = sort_against(self.types, self.sizes, reverse)
            try:
                self.sizes.sort(reverse=reverse)
            except:
                pass
        elif column == 3:
            values = [self._data[key] for key in self.keys]
            self.keys = sort_against(self.keys, values, reverse)
            self.sizes = sort_against(self.sizes, values, reverse)
            self.types = sort_against(self.types, values, reverse)
        self.beginResetModel()
        self.endResetModel()