December 2018
Beginner to intermediate
404 pages
10h 14m
English
Our Kanban view used the t-if directive in the card option menu to make some options available depending on some conditions. The t-if directive expects an expression to be evaluated in JavaScript when rendering Kanban views on the client side. The tag and its content will be rendered only if the condition evaluates to true.
As an example, to only display the checkout's number of books borrowed if it has a value, add the following after the request_date field:
<t t-if="record.num_books.raw_value gt 0"> <li> <field name="num_books"/> books</li> </t>
We used a <t t-if="..."> element so that if the condition is false, the element produces no output. If it's true, only the contained <li> element is rendered to the output. ...
Read now
Unlock full access