There's more...

The reason for going to the effort of using QWeb here was extensibility, and this is the second big difference between client-side and server-side Qweb. On the client side, you can't use XPath expressions; you need to use jQuery selectors and operations. If, for example, we want to add user icons in our widget from another module, we'll use the following code to have an icon in each pill:

<t t-extend=“FieldColorPills”>
<t t-jquery=“span” t-operation=“prepend”>
<i class=“fa fa-user” />
</t>
</t>

If we also gave a t-name attribute here, we'd have made a copy of the original template and left that one untouched. Other possible values for the t-operation attribute are append, before, after, inner, and replace, which causes the content of the t element to either be appended to the content of the matched element via append, put before or after the matched element via before or after, replace the content of the matched element via inner, or replace the complete element via replace. There's also t-operation=‘attributes', which allows you to set an attribute on the matched element, following the same rules as server-side QWeb.

Another difference is that the names in client-side QWeb are not namespaced by the module name, so you have to choose names for your templates that are probably unique over all add-ons you install, which is why developers tend to choose rather long names.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset