Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mixedfield: a datagrid field / widget for Plone 6 #493

Merged
merged 5 commits into from May 6, 2021

Conversation

ksuess
Copy link
Member

@ksuess ksuess commented Mar 22, 2021

…ct-widget

@sneridagh
Copy link
Member

sneridagh commented Mar 24, 2021

@ksuess I pushed these days an small but (I think) important micro-feature:
plone/plone.schema#11
plone/plone.restapi#1091

so now we will be able to do:

       mixed_field = JSONField(
             # datagrid, mixedfield, field, Plone, json, frontend, Volto
             title=u'Mixedfield: datagrid field for Plone',
             required=False,
             schema=MIXEDFIELD_SCHEMA,
             default={"items": []},
             missing_value={"items": []},
             widget="my_datagrid_widget"
             )

then in the config:

config.widgets.widgets.my_datagrid_widget = MyDatagridWidget

This is important so we do not override field "ids" (which is a kid of a workaround for fields that do not have the ability to state its widget, or we are not able to infer a proper one), but assigning a proper widget.

@sneridagh
Copy link
Member

From plone.schema = 1.3.0
and (upcoming, not merged yet) plone.restapi release

@sneridagh
Copy link
Member

plone.restapi supporting this: https://pypi.org/project/plone.restapi 7.3.0

@sneridagh
Copy link
Member

@ksuess It would be great if we could have some narrative docs about this in Volto docs as well! "How to use Volto widgets in DX content types". What do you think?

Also, preparing this:
plone/volto#2294

So we will have the full story in Volto core now. :)

@ksuess
Copy link
Member Author

ksuess commented Mar 25, 2021

@sneridagh, great that you instantaneous could take the time to enhance the JSONField / datagrid topic. This should be documented also in Volto official documentation, yes. I would love to contribute, but please give me some days, I'm working on 17 construction sites.

@sneridagh
Copy link
Member

@ksuess well, not instantaneous, it's been in the back of my head since long. The current shape of Plone widget serialisation is quite a mess, the use cases and implementations seems to be infinite, I sweat blood back in the day when I wrote the Widget extensibility story. Coincidentally, we had that same requirement in one of our projects, in fact, we did it so far using your approach! So I spent some time investigating if we could have a better story and came up with this.

Thanks for taking time investigating this subject and for writing this for the training.

@ksuess
Copy link
Member Author

ksuess commented Apr 10, 2021

I am struggling with the first sentence. Feedback is welcome.

The mixedfield empowers your user to create a list of arrays of mixed value types.

And of course the complete text is open for feedback. Thanks in advance.

@ksuess ksuess requested review from pbauer and sneridagh April 10, 2021 20:55
@sneridagh
Copy link
Member

Looks awesome!

My 5 cents on the sentence, but no special strong opinion on it:
The mixedfield empowers your user to create a list of objects of mixed value types sharing the same schema.

Not very inspired this evening either 😅

@ksuess ksuess changed the title mixedfield: a datagrid field / widget for Plone 6 with eea volto-obje… mixedfield: a datagrid field / widget for Plone 6 May 6, 2021
@ksuess ksuess marked this pull request as ready for review May 6, 2021 05:14
@ksuess ksuess merged commit 5ec21f4 into master May 6, 2021
@ksuess ksuess deleted the dexterity-reference-datagridfield-plone6 branch May 6, 2021 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants