Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
4 Replies
11628 Tampilan

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
Buang
Jawaban Terbai

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
Buang
Penulis

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


Jawaban Terbai

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
Buang

thank you!

Post Terkait Replies Tampilan Aktivitas
3
Mei 23
15666
0
Des 21
2855
2
Jul 25
4616
1
Jun 25
2028
2
Jun 25
652