Managing user actions in an OWL component
To make the UI interactive, components need to handle user actions
such as click
, hover
, and form submission
. In this recipe, we will add a button to our component, and we will handle a click event.
Getting ready
For this recipe, we will continue using the my_hostel
module from the previous recipe.
How to do it...
In this recipe, we will add a delete button to the component. Upon clicking the delete button, the component gets removed. Perform the following steps to add a delete button and its event in the component:
- Update the QWeb template and add an icon to remove the bar:
class MyComponent extends Component { Â Â Â Â static template = xml` Â Â Â Â Â Â Â Â <div class="bg-info text-white text-center p-3"> Â Â Â Â Â Â Â Â Â Â Â Â <b> Welcome To Odoo </b> Â Â Â Â Â Â Â Â ...