Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

what is t-jquery in qweb?

By
samba
on 1/10/15, 9:35 PM 3,243 views
4

Dhinesh - Technical Consultant, Sodexis Inc

--Dhinesh - Technical Consultant, Sodexis Inc--
3577
| 5 4 9
Pondicherry, India
--Dhinesh - Technical Consultant, Sodexis Inc--

Passionate coder in Python/OpenERP. Knows Django/Flask MVC frameworks. Did code in Java, PHP.

Contact me at: dvdhinesh.mail@gmail.com

Dhinesh - Technical Consultant, Sodexis Inc
On 1/10/15, 11:20 PM

In general, it is used for template inheritance which used to select the particular Jquery selector's from template view. From documentation,

Template inheritance:

Template inheritance is used to alter existing templates in-place, e.g. to add information to templates created by an other modules.

Template inheritance is performed via the t-extend directive which takes the name of the template to alter as parameter.

The alteration is then performed with any number of t-jquery sub-directives:

<t t-extends="base.template">
     <t t-jquery="ul" t-operation="append">
         <li>new element</li>
     </t>
</t>

The t-jquery directives takes a CSS selector. This selector is used on the extended template to select context nodes to which the specified t-operation is applied:

append

the node’s body is appended at the end of the context node (after the context node’s last child)

prepend

the node’s body is prepended to the context node (inserted before the context node’s first child)

before

the node’s body is inserted right before the context node

after

the node’s body is inserted right after the context node

inner

the node’s body replaces the context node’s children

replace

the node’s body is used to replace the context node itself

No operation

if no t-operation is specified, the template body is interpreted as javascript code and executed with the context node as this

Syntax:

t-jquery=selector [t-operation=operation] BODY

Parameters:

  • selector (String) – a CSS selector into the parent template
  • operation – one of append, prepend, before, after, inner or replace.
  • BODY – operation argument, or alterations to perform

 

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 1/10/15, 9:35 PM
Seen: 3243 times
Last updated: 3/16/15, 8:10 AM