This topic contains 2 replies, has 2 voices, and was last updated by jakabadambalazs 9 years, 5 months ago.
- Topic
Hi,
I have two entities: listGroup and ListItem and in listGroup’s view i have a datagrid like this:
123456789101112131415161718192021222324252627282930313233listitems-grid:options:toolbarOptions:pageSize:default_per_page: 50extended_entity_name: %mekit_list.listitem.entity.class%source:type: ormacl_resource: mekit_list_viewquery:select:- li.id- li.labelfrom:- { table: %mekit_list.listitem.entity.class%, alias: li }join:inner:- { join: li.listGroup, alias: lg }where:and:- lg.id = :entity_idbind_parameters:- entity_idcolumns:id:label: mekit.list.id.labellabel:label: mekit.list.label.labeltype: twigfrontend_type: htmltemplate: MekitListBundle:Item:Datagrid/Property/editButton.html.twigI have the editButton.html.twig:
123456789101112131415161718192021222324252627282930{% import 'OroUIBundle::macros.html.twig' as UI %}{% if resource_granted('mekit_listitem_update') %}{% set updateListItemTitle = 'mekit.list.widgets.listitem_update'|trans %}{{ UI.clientLink({'dataUrl': path('mekit_listitem_update', { 'id': record.getValue('id') }),'aCss': 'no-hash','iCss': 'icon-edit','dataId': record.getValue('id'),'title' : updateListItemTitle,'label' : value|trans,'widget' : {'type' : 'dialog','multiple' : false,'reload-grid-name' : 'listitems-grid','options' : {'alias': 'listitem_dialog','stateEnabled': true,'dialogOptions' : {'title' : updateListItemTitle,'allowMaximize': false,'allowMinimize': false,'width': 600}}}}) }}{% else %}{{- value|trans -}}{% endif %}which opens the ListItem’s edit form which has the following twig:
123456789101112131415161718192021222324252627282930313233343536373839{% form_theme form with ['OroFormBundle:Form:fields.html.twig', _self] %}<div class="widget-content">{% if saved %}<script type="text/javascript">require(['underscore', 'orotranslation/js/translator', 'oroui/js/widget-manager','oroui/js/messenger', 'oroui/js/mediator'],function(_, __, widgetManager, messenger, mediator) {widgetManager.getWidgetInstance({{ app.request.get('_wid')|json_encode|raw }}, function(widget) {messenger.notificationFlashMessage('success', __('Item saved successfully'));mediator.trigger('widget_success:' + widget.getAlias());mediator.trigger('widget_success:' + widget.getWid());widget.remove();});});</script>{% else %}{% if not form.vars.valid and form.vars.errors|length %}<div class="alert alert-error"><div class="message">{{ form_errors(form) }}</div></div>{% endif %}<div class="form-container"><form id="{{ form.vars.name }}" action="{{ formAction }}" method="post" class="listitem-form"><fieldset class="form-horizontal">{{ form_row(form.id) }}{{ form_row(form.label) }}{{ form_rest(form) }}<div class="widget-actions form-actions" style="display: none;"><button class="btn" type="reset">{{ 'Cancel'|trans }}</button><button class="btn btn-primary" type="submit">{{ 'Save'|trans }}</button></div></fieldset></form>{{ oro_form_js_validation(form) }}</div>{% endif %}</div>Everything works fine except one strange thing – every time I edit a ListItem I see that the grid is being reloaded (/app_dev.php/datagrid/listitems-grid?listitems-grid%5Bentity_id%5D=2&listitems-grid%5B_pager%5D%5B_page%5D=1&listitems-grid%5B_pager%5D%5B_per_page%5D=10&listitems-grid%5B_parameters%5D%5Brefresh%5D=true) more and more times.
That is, by the time I edited 10 times I see that before the dialog diappeares, I see the reload actions triggered 10 times.Can you check the code above to see if there is something strange?
thanks
a\oro/platform(1.6.2) + oro/doctrine-extensions(1.0.7) + symfony/symfony(v2.3.27)
The forum ‘OroPlatform – Programming Questions’ is closed to new topics and replies.