directus/directus

UI: "Matrix" Dynamic Editor

benhaynes asked for this feature 9 months ago — 1 comment

benhaynes commented 9 months ago Admin

Same as current M2M UI, except: 1. Junction table also stores the related table 2. UI is editable inline instead of each item opening in an overlay

Below is one direction, but you could just as easily store data in the junction table itself instead of multiple related tables.

Example of schema:

THIS TABLE - matrix_column (ALIAS) Like a M2M but also stores the related table...

JUNCTION TABLE - id - sort - matrixid - relatedtable (NEW!) - related_id

RELATED TABLE VARCHAR - id - title (VARCHAR)

RELATED TABLE TEXT - id - text (TEXT)

RELATED TABLE INT - id - image (INT)

Example of what junction table stores:

{ id: 1, sort: 1, parentid: 1, relatedtable: 'varchar', relatedid: 1, data: { title: "My Matrix Title" } }, { id: 2, sort: 2, parentid: 1, relatedtable: 'text', relatedid: 1, data: { text: "Lorem ipsum dolor et..." } }, { id: 3, sort: 3, parentid: 1, relatedtable: 'image', related_id: 1, data: { image: 1, data: { url: "my-file.jpg" } } }

Join the discussion!

Sign-in with GitHub to comment