Se rendre au contenu
Menu
Cette question a été signalée
4 Réponses
11602 Vues

I'm trying to show/hide content of a div with specific ID. Normally I would use the jquery hide(), show() commands. Can someone give me an example how to use hide, show in a qweb template or is there a better way to do this?

And I have read the documentation for QWEB and javascript, but I don't get it. So please no copy/paste the example from the documentation.  

Avatar
Ignorer
Meilleure réponse

For example:

you can use the t-if attribute with templates. For more reference have a look at website templates .

<div t-if="object.val == 'x'">
    ....
</div>
Avatar
Ignorer
Auteur

ok... I know how to use t-if, and I'm using it to show divs after submit, but I don't know how to use javascript or jquery in QWEB templates to show hide data without reloading the page.

Okay, then you should try with some hidden classes. Add some hidden class according to your condition using jquery to the div. bootstrap already have hidden classes. Here are some references of helper classes already inbuilt in bootstrap.

On Tue, Jul 17, 2018 at 11:32 AM, Samo Arko <samo.arko@tabla.si> wrote:

ok... I know how to use t-if, and I'm using it to show divs after submit, but I don't know how to use javascript or jquery in QWEB templates to show hide data without reloading the page.

--
Samo Arko

Sent by Odoo S.A. using Odoo.




--
Hilar AK  Python / Odoo Developer

m: +917736617619
e: hilarak@gmail.com
Follow me:
twitteryoutubegithubstack-overflow


Meilleure réponse

This is just an idea.

<script>        
    function reply_click(clicked_id)       
    {           
        $("p").toggle();       
    };       
</script>
<button  onClick="reply_click(this.id)" t-att-id="'hide' +  str(i)" type="button">+</button> 


Avatar
Ignorer

thank you!

Publications associées Réponses Vues Activité
3
mai 23
15613
0
déc. 21
2843
2
juil. 25
4549
1
juin 25
2019
2
juin 25
630