code: def _set_sort_expressions(self):
          
          sort_expressions = []
          i = 0
          while self.params.get('order[{:d}][column]'.format(i), False):
              column_nr = int(self.params.get('order[{:d}][column]'.format(i)))
              column = self.columns[column_nr]
              direction = self.params.get('order[{:d}][dir]'.format(i))
              sort_expr = column.sqla_expr
              if direction == 'asc':
                  sort_expr = sort_expr.asc()
              elif direction == 'desc':
                  sort_expr = sort_expr.desc()
              else:
                  raise ValueError(
                      'Invalid order direction: {}'.format(direction))
              if column.nulls_order:
                  if column.nulls_order == 'nullsfirst':
                      sort_expr = sort_expr.nullsfirst()
                  elif column.nulls_order == 'nullslast':
                      sort_expr = sort_expr.nullslast()
                  else:
                      raise ValueError(
                          'Invalid order direction: {}'.format(direction))
  
              sort_expressions.append(sort_expr)
              i += 1
          self.sort_expressions = sort_expressions
docs: Construct the query: sorting.
  
          Add sorting(ORDER BY) on the columns needed to be applied on.