Important
You are browsing the documentation for version 3.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.
Highlight Text View¶
Highlight Text View is used to highlight text in view element.
Example: highlight query string in search results.
Initialization¶
Initialize in twig:
1 //example from System Configuration page content
2 <div data-page-component-view="{{ {
3 view: 'oroui/js/app/views/highlight-text-view',
4 highlightSwitcherContainer: 'div.system-configuration-content-header',
5 highlightStateStorageKey: 'show-all-configuration-items-on-search',
6 highlightSelectors: [
7 'div.system-configuration-content-title',
8 'h5.user-fieldset span',
9 'div.control-label label',
10 'i.tooltip-icon'
11 ],
12 toggleSelectors: {
13 'div.control-group': 'div.control-group-wrapper',
14 'fieldset.form-horizontal': 'div.system-configuration-content-inner'
15 },
16 viewGroup: 'configuration'
17 }|json_encode }}">
18 {{ _self.renderTabContent(data.form, data.content) }}
19 </div>
Initialize in JavaScript:
1 //example from "oroui/js/app/views/jstree/base-tree-view"
2 this.subview('highlight', new HighlightTextView({
3 el: this.el,
4 viewGroup: 'configuration',
5 highlightSelectors: ['.jstree-search']
6 }));
Options¶
text:string - text to highlight
viewGroup:string - used as mediator event prefix
highlightSwitcherContainer:string - a class or attribute in which will render template of highlight switcher
highlightStateStorageKey:string - localStorage key which will contain state of visibility for not found/highlighted elements
highlightClass:string - class used for text highlight
notFoundClass:string - class used for mark content without highlighted elements
foundClass:string - class used for mark content with highlighted elements
highlightSelectors:array - array of selectors that used to find elements to highlight
toggleSelectors:object - array of selectors that used to find elements to mark as found or not found