diff --git a/content/developer/reference/frontend/owl_components.rst b/content/developer/reference/frontend/owl_components.rst index a66a0b4a5..6feb9d43a 100644 --- a/content/developer/reference/frontend/owl_components.rst +++ b/content/developer/reference/frontend/owl_components.rst @@ -216,7 +216,7 @@ features such as: - Direct siblings dropdowns: when one is open, toggle others on hover - Close on outside click - Optionally close the item list when an item is selected -- Emit an event to inform which list item is clicked +- Call a function when the item is selected - Support sub dropdowns, up to any level - SIY: style it yourself - Configurable hotkey to open/close a dropdown or select a dropdown item @@ -236,8 +236,8 @@ for each element in the item list. Click me to toggle the dropdown menu ! - Menu Item 1 - Menu Item 2 + Menu Item 1 + Menu Item 2 Props @@ -288,11 +288,7 @@ being present in the DOM or not. A `` is simply a span (``). -When a `` is selected, it emits a custom `dropdown-item-selected` -event containing its payload. (see -`OWL Business Events `_). -So, to react to such an event, one needs to define an event listener on the -`dropdown-item-selected` event. +When a `` is selected, it calls its `onSelected` prop. If this prop is a method, make sure it is bound if the method need to use the `this` value. .. list-table:: :widths: 20 20 60 @@ -301,9 +297,9 @@ So, to react to such an event, one needs to define an event listener on the * - DropdownItem - Type - Description - * - ``payload`` - - Object - - payload that will be added to the `dropdown-item-selected` event (default to null) + * - ``onSelected`` + - Function + - a function that will be called when the dropdown item is selected. * - `parentClosingMode` - `none` | `closest` | `all` - when the item is selected, control which parent dropdown will get closed: @@ -317,6 +313,9 @@ So, to react to such an event, one needs to define an event listener on the * - ``title`` - string - optional title attribute which will be passed to the root node of the DropdownItem. (default: not provided) + * - ``dataset`` + - Object + - optional object containing values that should be added to the root element's dataset. This can be used so that the element is easier to find programmatically, for example in tests or tours. Technical notes ~~~~~~~~~~~~~~~ @@ -359,23 +358,23 @@ others will open themselves on hover. .. code-block:: xml -
+
File - Open - New Document - New Spreadsheet + Open + New Document + New Spreadsheet Edit - Undo - Redo - Search + Undo + Redo + Search About - Help - Check update + Help + Check update
@@ -388,11 +387,11 @@ the `New` and `Save as...` sub elements. .. code-block:: xml - + File - Open + Open - Save + Save @@ -400,16 +399,16 @@ the `New` and `Save as...` sub elements. New - Document - Spreadsheet + Document + Spreadsheet Save as... - CSV - PDF + CSV + PDF @@ -418,19 +417,19 @@ Example: Multi-level Dropdown (nested) .. code-block:: xml - + File - Open + Open New - Document - Spreadsheet + Document + Spreadsheet - Save + Save Save as... - CSV - PDF + CSV + PDF @@ -442,7 +441,7 @@ In this example, we recursively call a template to display a tree-like structure .. code-block:: xml -
+
@@ -457,7 +456,7 @@ In this example, we recursively call a template to display a tree-like structure - +