Important
You are browsing the documentation for version 4.1 of OroCommerce, OroCRM and OroPlatform, which is no longer maintained. Read version 5.1 (the latest LTS version) of the Oro documentation to get up-to-date information.
See our Release Process documentation for more information on the currently supported and upcoming releases.
Layout Subtree View¶
The layout subtree is used to reload content of some layout block via Ajax request.
Initialization¶
Layout update:
1 layout:
2 actions:
3 - '@addTree':
4 ...
5 tree:
6 layout_block_id: ~
Add LayoutSubtreeView in block template:
1 {% block _layout_block_id_widget %}
2 <div id="block_id"
3 data-page-component-module="oroui/js/app/components/view-component"
4 data-page-component-options="{{ {
5 view: 'oroui/js/app/views/layout-subtree-view',
6 blockId : id,
7 reloadEvents: ['reload-on-event'],
8 restoreFormState: true
9 }|json_encode }}"
10 >
11 {{ block_widget(block) }}
12 </div>
13 {% endblock %}
Or initialize in JavaScript:
1 var LayoutSubtreeView = require('oroui/js/app/views/layout-subtree-view');
2 var layoutSubtree = new LayoutSubtreeView({
3 el: '#block_id',
4 blockId: 'layout_block_id',
5 reloadEvents: ['reload-on-event'],
6 restoreFormState: true
7 });
8
9 //then call reload method
10 layoutSubtree.reloadLayout();
11
12 //or trigger reload event in other script
13 var mediator = require('oroui/js/mediator');
14 mediator.trigger('reload-on-event');