Important
You are browsing documentation for version 5.1 of OroCommerce, supported until March 2026. Read the documentation for version 6.0 (the latest LTS version) 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:
layout:
actions:
- '@addTree':
...
tree:
layout_block_id: ~
Add LayoutSubtreeView in block template:
{% block _layout_block_id_widget %}
<div id="block_id"
data-page-component-module="oroui/js/app/components/view-component"
data-page-component-options="{{ {
view: 'oroui/js/app/views/layout-subtree-view',
blockId : id,
reloadEvents: ['reload-on-event'],
restoreFormState: true
}|json_encode }}"
>
{{ block_widget(block) }}
</div>
{% endblock %}
Or initialize in JavaScript:
var LayoutSubtreeView = require('oroui/js/app/views/layout-subtree-view');
var layoutSubtree = new LayoutSubtreeView({
el: '#block_id',
blockId: 'layout_block_id',
reloadEvents: ['reload-on-event'],
restoreFormState: true
});
//then call reload method
layoutSubtree.reloadLayout();
//or trigger reload event in other script
var mediator = require('oroui/js/mediator');
mediator.trigger('reload-on-event');