Add (back in) self.columns and use in move_column to provide index='end' convenience to move a column to the end (rightmost in UI)
This commit is contained in:
parent
b23147ce48
commit
5f24f5bd69
|
@ -213,6 +213,7 @@ class RefineProject:
|
||||||
self.history_entry = None
|
self.history_entry = None
|
||||||
# following filled in by get_models()
|
# following filled in by get_models()
|
||||||
self.has_records = False
|
self.has_records = False
|
||||||
|
self.columns = None
|
||||||
self.column_order = {} # order of columns in UI
|
self.column_order = {} # order of columns in UI
|
||||||
self.rows_response_factory = None # for parsing get_rows()
|
self.rows_response_factory = None # for parsing get_rows()
|
||||||
self.get_models()
|
self.get_models()
|
||||||
|
@ -249,6 +250,7 @@ class RefineProject:
|
||||||
response = self.do_json('get-models', include_engine=False)
|
response = self.do_json('get-models', include_engine=False)
|
||||||
column_model = response['columnModel']
|
column_model = response['columnModel']
|
||||||
column_index = {}
|
column_index = {}
|
||||||
|
self.columns = [column['name'] for column in column_model['columns']]
|
||||||
for i, column in enumerate(column_model['columns']):
|
for i, column in enumerate(column_model['columns']):
|
||||||
name = column['name']
|
name = column['name']
|
||||||
self.column_order[name] = i
|
self.column_order[name] = i
|
||||||
|
@ -414,6 +416,8 @@ class RefineProject:
|
||||||
|
|
||||||
def move_column(self, column, index):
|
def move_column(self, column, index):
|
||||||
"""Move column to a new position."""
|
"""Move column to a new position."""
|
||||||
|
if index == 'end':
|
||||||
|
index = len(self.columns) - 1
|
||||||
response = self.do_json('move-column', {'columnName': column,
|
response = self.do_json('move-column', {'columnName': column,
|
||||||
'index': index})
|
'index': index})
|
||||||
self.get_models()
|
self.get_models()
|
||||||
|
|
Loading…
Reference in New Issue