There’s more...

The reason for making the effort to use 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 we, for example, want to change our widget in yet another module, we’d use the following code to have each of our buttons show a user icon before the user’s name:

<t t-extend=“FieldMany2OneButtons”>
<t t-jquery=“button” 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 cause the content of the t element to be either appended to the content of the matched element, put before or after the matched element, replace the content of the matched element (inner), or replace the complete element (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 tacit difference is that 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 addons 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
3.147.65.247