mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Barely working reference lists in frontend
Summary: This makes it possible to set the type of a column to ReferenceList, but the UI is terrible ReferenceList.ts is a mishmash of ChoiceList and Reference that sort of works but something about the CSS is clearly broken ReferenceListEditor is just a text editor, you have to type in a JSON array of row IDs. Ignore the value that's present when you start editing. I can maybe try mashing together ReferenceEditor and ChoiceListEditor but it doesn't seem wise. I think @georgegevoian should take over here. Reviewing the diff as it is to check for obvious issues is probably good but I don't think it's worth trying to land/merge anything. Test Plan: none Reviewers: dsagal Reviewed By: dsagal Subscribers: georgegevoian Differential Revision: https://phab.getgrist.com/D2914
This commit is contained in:
@@ -270,7 +270,7 @@ class Table(object):
|
||||
self._summary_simple = not any(
|
||||
isinstance(
|
||||
self._summary_source_table.all_columns.get(group_col),
|
||||
column.ChoiceListColumn
|
||||
(column.ChoiceListColumn, column.ReferenceListColumn)
|
||||
)
|
||||
for group_col in groupby_cols
|
||||
)
|
||||
@@ -299,12 +299,13 @@ class Table(object):
|
||||
@usertypes.formulaType(usertypes.ReferenceList(summary_table.table_id))
|
||||
def _updateSummary(rec, table): # pylint: disable=unused-argument
|
||||
# Create a row in the summary table for every combination of values in
|
||||
# ChoiceList columns
|
||||
# list type columns
|
||||
lookup_values = []
|
||||
for group_col in groupby_cols:
|
||||
lookup_value = getattr(rec, group_col)
|
||||
if isinstance(self.all_columns[group_col], column.ChoiceListColumn):
|
||||
# Check that ChoiceList cells have appropriate types.
|
||||
if isinstance(self.all_columns[group_col],
|
||||
(column.ChoiceListColumn, column.ReferenceListColumn)):
|
||||
# Check that ChoiceList/ReferenceList cells have appropriate types.
|
||||
# Don't iterate over characters of a string.
|
||||
if isinstance(lookup_value, (six.binary_type, six.text_type)):
|
||||
return []
|
||||
|
||||
Reference in New Issue
Block a user