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:
@@ -188,10 +188,10 @@ def ISREF(value):
|
||||
"""
|
||||
Checks whether a value is a table record.
|
||||
|
||||
For example, if a column person is of type Reference to the People table, then ISREF($person)
|
||||
is True.
|
||||
Similarly, ISREF(People.lookupOne(name=$name)) is True. For any other type of value,
|
||||
ISREF() would evaluate to False.
|
||||
For example, if a column `person` is of type Reference to the `People` table,
|
||||
then `ISREF($person)` is `True`.
|
||||
Similarly, `ISREF(People.lookupOne(name=$name))` is `True`. For any other type of value,
|
||||
`ISREF()` would evaluate to `False`.
|
||||
|
||||
>>> ISREF(17)
|
||||
False
|
||||
@@ -202,6 +202,25 @@ def ISREF(value):
|
||||
return isinstance(value, Record)
|
||||
|
||||
|
||||
def ISREFLIST(value):
|
||||
"""
|
||||
Checks whether a value is a [`RecordSet`](#recordset),
|
||||
the type of values in Reference List columns.
|
||||
|
||||
For example, if a column `people` is of type Reference List to the `People` table,
|
||||
then `ISREFLIST($people)` is `True`.
|
||||
Similarly, `ISREFLIST(People.lookupRecords(name=$name))` is `True`. For any other type of value,
|
||||
`ISREFLIST()` would evaluate to `False`.
|
||||
|
||||
>>> ISREFLIST(17)
|
||||
False
|
||||
>>> ISREFLIST("Roger")
|
||||
False
|
||||
|
||||
"""
|
||||
return isinstance(value, RecordSet)
|
||||
|
||||
|
||||
def ISTEXT(value):
|
||||
"""
|
||||
Checks whether a value is text.
|
||||
|
||||
Reference in New Issue
Block a user