Skip to content

Values not being saved when using select2 widget inside of DataGridField. #38

Description

@andreesg

When using RelatedItemsWidget or AjaxSelectWidget inside of a DataGridField the values added to a new row are not saved. Values from other subfields (TextLine for example) are saved.

The issue can be reproduced using the following dependencies:

plone.app.widgets = 1.x
collective.z3cform.datagridfield = 1.1

Steps to reproduce:

Install collective.z3cform.datagridfield and create a content type using this as a datagrid field:

category = ListField(title=_(u’Category')
        value_type=DictRow(title=_(u'Category'), schema=ICategory),
        required=False)
form.widget(category=DataGridFieldFactory)

Create the interface schema:

class ICategory(form.Schema):
    form.widget('name', AjaxSelectFieldWidget, vocabulary=“your.product.vocabulary")
    name = schema.List(
        title=_(u'Category'),
        required=False,
        value_type=schema.TextLine(),
        missing_value=[]
    )
    notes = schema.Text(title=_(Notes'), required=False)

I noticed that the values are getting empty to the GridDataConverter.
The extract function from DataGridFieldObject also returns the new rows with empty values for the subfields that are using the select2 widgets.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions