ullWidgetFormDoctrineChoice - inline create/edit of select box entries
Introduction
When editing a data set we often have select boxes for related objects.
ullright allows mostly automated inline adding or editing of the select box options via an javascript/ajax overlay.
The inline editing is supported by ullMetaWidgetForeignKey and descendants. It's enabled via columnsConfig:
$this['foreign_model_id'] ->setWidgetOption('enable_inline_editing', true) ;
Overview
- A "create" and "edit" icon are rendered next to the select box.
- ullWidgetFormDoctrineChoice with option "enable_inline_editing" set to true
- When clicking on it, a html overlay is opened, and the edit page of the particular object is loaded via ajax.
- BaseUllTableToolActions::executeEdit()
- The user can now create or edit the current object.
- When finished, the user clicks on save and the form content is sent via ajax
- editSucess.php (ullTableTool module)
- In case of validation errors the page is reloaded displaying the errors and allowing correction.
- BaseUllTableToolActions::executeEdit() returns the html markup
- Otherwise the object is saved and the overlay closed.
- BaseUllTableToolActions::executeEdit() returns json with the object id
- editSucess.php (ullTableTool module) saves the object id in a global js var and closes the overlay
- Finally the original select box is refreshed, while the created entry is automatically selected.
- ullWidgetFormDoctrineChoice listens for the "overlay close" event, and reloads the widget data if the widget data was modified.
- To allow the reload of the widget, the originating action must provide the enableAjaxSingleWidgetRendering() method.
This is necessary to comply to the correct access restrictions
Access rights / Permissions
To allow inline editing of a related model, you have to set permissions:
- Admin -> Permissions -> Add
- ull_tabletool_my_model
- Example: ull_tabletool_ull_course_tariff
- Admin -> Group Permissions -> Add
- Group: My group
- Permission: ull_tabletool_my_model