Using a datagridfield for managing list of values

18 views
Skip to first unread message

thomas desvenain

unread,
Feb 13, 2014, 12:15:04 PM2/13/14
to dexterity-...@googlegroups.com
Hi,

For now, when we change a value (for example, the spelling) in the list of vocabulary values of a field, we lose the matching with contents.

What do you think about replacing the list of values by a one-column table of labels with hidden tokens, so that we can update the label without updating the stored value ?
We need to change the way to store the model so that we can store key/label values.
We could use datagridfield widget there.

I can work on this (we need it)

--
Thomas Desvenain

Téléphone : 09 51 37 35 18

Sean Upton

unread,
Feb 13, 2014, 3:23:31 PM2/13/14
to dexterity-...@googlegroups.com
On Thu, Feb 13, 2014 at 10:15 AM, thomas desvenain
<thomas.d...@gmail.com> wrote:
> Hi,
>
> For now, when we change a value (for example, the spelling) in the list of
> vocabulary values of a field, we lose the matching with contents.
>
> What do you think about replacing the list of values by a one-column table
> of labels with hidden tokens, so that we can update the label without
> updating the stored value ?
> We need to change the way to store the model so that we can store key/label
> values.
> We could use datagridfield widget there.

I assume you are discussing the Choice (of TextLine) fields in
plone.schemaeditor? I suspect it might be better to make a new add-on
and field type (that could supplement or replace the Choice/Multiple
Choice fields available in schema editor) that uses a UUID-based token
for each term title. In such case, I suppose a data-grid might work
in the field editor.

Sean

thomas desvenain

unread,
Feb 21, 2014, 9:05:21 AM2/21/14
to dexterity-...@googlegroups.com
Hi sean

We don't want to change the behaviour of the edited field,
we want to use Choice / Multiple Choice fields as usual

we want to change the behaviour of the field to edit, in field edit form,
the values of the Choix / Multiple Choice field. In my way, we don't want to add new field types.

We want :
- a new field to edit vocabulary values:
  in ITextLineChoice,  values would not be a List but a DataGrid, with two columns : token and label
- a widget that allow us to edit only the label column, and that fills a hidden token column with a value when we add a new label
- a new TextLineChoiceField (plone.schemaeditor.fields) that construct the vocabulary using token column for token and value and label column for title
- a in plone.supermodel.exportimport.ChoiceHandler, just implement export in write method where we get for now

                if (not isinstance(term.value, (str, unicode), )
                    or term.token != term.value.encode('unicode_escape')):
                    raise NotImplementedError(u"Cannot export a vocabulary that is not "
                                               "based on a simple list of values")

with backward compatibility of course

There is a lot of things to do but we may get ressources for that.




Sean

--
You received this message because you are subscribed to the Google Groups "Dexterity development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dexterity-develo...@googlegroups.com.
To post to this group, send email to dexterity-...@googlegroups.com.
Visit this group at http://groups.google.com/group/dexterity-development.
For more options, visit https://groups.google.com/groups/opt_out.

David Glick (Plone)

unread,
Feb 22, 2014, 3:24:09 PM2/22/14
to dexterity-...@googlegroups.com
That could work, but one downside is that it is possible for a user to
totally change a label, and end up with the old token that has no
connection to the label.

I was also kind of hoping to avoid the complexity of adding this kind of
implementation.

As an alternative, what about taking the approach of PloneKeywordManager
and having some tools to help update/merge/delete values on existing
content items? This would require having an index of the field, though.
Reply all
Reply to author
Forward
0 new messages