We have two methods and features to display content.
1-format the widget's data
2-display the widget
The HomePage widget already has a start() method. This method is part of the normal widget lifecycle and it is automatically called once the widget is inserted in the page. We can use this method to display some content.
All widgets have a sel which represents the section of page they're in charge of (as a jQuery object). Widget content should be inserted there. By default, sel is an empty element.
An element is usually invisible to the user if it has no content (or without specific styles giving it a size) which is why nothing is displayed on the page when HomePage is launched.
And add some content to the widget's root element, using jQuery,code is below.
local.HomePage = instance.Widget.extend({
start: function() {
this.$el.append("Hello dear Odoo user!
");
},
});
Note- This message will now appear when you open Pet Store Pet Store Home Page.
0 Comment(s)