Perform sorting of columns.
350739
public function ordering()
    {
        if ($this->orderCallback) {
            return call_user_func($this->orderCallback, $this->resolveCallbackParameter());
        }

        return $this->defaultOrdering();
    }
313388
def sort_ascending(self, key):
        """"""

        row, col, tab = key

        scells = self.grid.code_array[:, col, tab]

        def sorter(i):
            sorted_ele = scells[i]
            return sorted_ele is None, sorted_ele

        sorted_row_idxs = sorted(xrange(len(scells)), key=sorter)

        self.replace_cells(key, sorted_row_idxs)

        self.grid.ForceRefresh()
782862
def check_columns(column, line, columns):
    
    return column <= min(len(line), max(columns))
209801
def _sort_layers(self):
        """"""
        self._layers = OrderedDict(sorted(self._layers.items(), key=lambda t: t[0]))
994174
def _order_queries(self):
        """"""
        from .condition import Order
        order = []
        for column in self.columns:
            if column.order_by:
                o = Order(self.cls, column.attr, column.order_by)
                order.append(o.__query__())
        if not order:
            k = self.columns[0].attr
            o = Order(self.cls, k)
            self.columns[0].order_by = o.order
            order.append(o.__query__())
        return order
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;
}
208141
def all_columns(self):
        """"""
        columns = set()
        for values in self._parts:
            for value in values._parts:
                columns.add(value.column_name)
        return sorted(columns)
1205823
def _make_columns(columns: List[Union[int, str]]) -> List[Dict]:
        """"""
        return [dict(title=str(c),
                     dataIndex=str(c),
                     key=str(c))
                for c in columns]
412977
void switchTwoColumns(int columnIndex, int columnToIndex) {
        for (int i = 0; i < getRowCount() - 1; i++) {
            Object cellData = getItems()[i][columnToIndex];
            getItems()[i][columnToIndex] = getItems()[i][columnIndex];
            getItems()[i][columnIndex] = cellData;
        }
    }
832298
function sort_columns( $vars ) {

        // Cycle through all sortable columns submitted by the user
        foreach ( $this->sortable as $column => $values ) {

            // Retrieve the meta key from the user submitted array of sortable columns
            $meta_key = $values[0];

            // If the meta_key is a taxonomy
            if( taxonomy_exists( $meta_key ) ) {

                // Sort by taxonomy.
                $key = "taxonomy";

            } else {

                // else by meta key.
                $key = "meta_key";
            }

            // If the optional parameter is set and is set to true
            if ( isset( $values[1] ) && true === $values[1] ) {

                // Vaules needed to be ordered by integer value
                $orderby = 'meta_value_num';

            } else {

                // Values are to be order by string value
                $orderby = 'meta_value';
            }

            // Check if we're viewing this post type
            if ( isset( $vars['post_type'] ) && $this->post_type_name == $vars['post_type'] ) {

                // find the meta key we want to order posts by
                if ( isset( $vars['orderby'] ) && $meta_key == $vars['orderby'] ) {

                    // Merge the query vars with our custom variables
                    $vars = array_merge(
                        $vars,
                        array(
                            'meta_key' => $meta_key,
                            'orderby' => $orderby
                        )
                    );
                }
            }
        }
        return $vars;
    }
1020335
def sort(self, request, reverse=False):
        """"""
        field = self.model._meta.fields.get(self.columns_sort)
        if not field:
            return self.collection

        if reverse:
            field = field.desc()

        return self.collection.order_by(field)
615211
def sort_by(self, name, sort_dir='asc'):
        """"""
        logger.log(5, "Sort by `%s` %s.", name, sort_dir)
        self.eval_js('table.sortBy("{}", "{}");'.format(name, sort_dir))
674683
private Table sortOn(IntComparator rowComparator) {
        Table newTable = emptyCopy(rowCount());

        int[] newRows = rows();
        IntArrays.parallelQuickSort(newRows, rowComparator);

        Rows.copyRowsToTable(newRows, this, newTable);
        return newTable;
    }
603923
def SetColumns( self, columns, sortOrder=None ):
        """"""
        self.columns = columns 
        self.sortOrder = [(x.defaultOrder,x) for x in self.columns if x.sortDefault]
        self.CreateColumns()
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
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()
123960
def sort(self, values):
        """"""
        for level in self:
            for wire1, wire2 in level:
                if values[wire1] > values[wire2]:
                    values[wire1], values[wire2] = values[wire2], values[wire1]