Skip to content

Commit

Permalink
[table viz] allow sorting on any column (#1601)
Browse files Browse the repository at this point in the history
* [table viz] allow sorting on any column

* explorev2
  • Loading branch information
mistercrunch committed Nov 17, 2016
1 parent 7531bb8 commit ab5da5b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion superset/forms.py
Expand Up @@ -134,7 +134,7 @@ def __init__(self, viz):
default_groupby = gb_cols[0] if gb_cols else None
group_by_choices = self.choicify(gb_cols)
order_by_choices = []
for s in sorted(datasource.num_cols):
for s in sorted(datasource.column_names):
order_by_choices.append((json.dumps([s, True]), s + ' [asc]'))
order_by_choices.append((json.dumps([s, False]), s + ' [desc]'))
# Pool of all the fields that can be used in Superset
Expand Down
2 changes: 1 addition & 1 deletion superset/views.py
Expand Up @@ -2142,7 +2142,7 @@ def fetch_datasource_metadata(self):

gb_cols = [(col, col) for col in datasource.groupby_column_names]
order_by_choices = []
for s in sorted(datasource.num_cols):
for s in sorted(datasource.column_names):
order_by_choices.append((json.dumps([s, True]), s + ' [asc]'))
order_by_choices.append((json.dumps([s, False]), s + ' [desc]'))

Expand Down
2 changes: 1 addition & 1 deletion superset/viz.py
Expand Up @@ -440,7 +440,7 @@ def query_obj(self):
if fd.get('all_columns'):
d['columns'] = fd.get('all_columns')
d['groupby'] = []
order_by_cols = fd.get('order_by_cols', []) or []
order_by_cols = fd.get('order_by_cols') or []
d['orderby'] = [json.loads(t) for t in order_by_cols]
return d

Expand Down

0 comments on commit ab5da5b

Please sign in to comment.