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

AjaxSelectWidget in Crud form #61

Open
Martronic-SA opened this issue Feb 28, 2017 · 0 comments
Open

AjaxSelectWidget in Crud form #61

Martronic-SA opened this issue Feb 28, 2017 · 0 comments

Comments

@Martronic-SA
Copy link

Martronic-SA commented Feb 28, 2017

I have a Crud form /@@DaTa that lists some content in the portal and shows the data as editable fields.
There is a problem when getting the relations vocabulary of a Select field for an item displayed in the crud table.

The vocab is taken from the data-pat-relateditems attribute, vocabularyUrl. sample:
data-pat-relateditems='{"vocabularyUrl": "http://xxxxxxxxxxx/dexterity-types/group/@@data/++widget++crud-edit.10.widgets.people/@@getSource", "searchText": "Search", "folderTypes": ["Folder"], "homeText": "Home", "basePath": "/xxxxxxx", "sort_on": "sortable_title", "rootPath": "/xxxxx", "sort_order": "ascending", "separator": ";", "treeVocabularyUrl": "http://xxxxxxxx/@@getVocabulary?name=plone.app.vocabularies.Catalog", "searchAllText": "Entire site"}'
but the vocabularyUrl is constructed with the main form URL (request.getURL()) and not with the item URL (the context is wrong)

        if field and getattr(field, 'vocabulary', None):
            form_url = self.request.getURL()
            source_url = "%s/++widget++%s/@@getSource" % (form_url, self.name)
            args['pattern_options']['vocabularyUrl'] = source_url
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

No branches or pull requests

1 participant