mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-19 16:52:29 +00:00
04e5d90f86
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
17 lines
469 B
TypeScript
17 lines
469 B
TypeScript
import {NTextEditor} from 'app/client/widgets/NTextEditor';
|
|
import {CellValue} from "app/common/DocActions";
|
|
|
|
|
|
/**
|
|
* A ReferenceListEditor offers an autocomplete of choices from the referenced table.
|
|
*/
|
|
export class ReferenceListEditor extends NTextEditor {
|
|
public getCellValue(): CellValue {
|
|
try {
|
|
return ['L', ...JSON.parse(this.textInput.value)];
|
|
} catch {
|
|
return null; // This is the default value for a reference list column.
|
|
}
|
|
}
|
|
}
|