Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
4 Respostas
11612 Visualizações

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
Cancelar
Melhor resposta

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
Cancelar
Autor

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


Melhor resposta

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
Cancelar

thank you!

Publicações relacionadas Respostas Visualizações Atividade
3
mai. 23
15637
0
dez. 21
2847
2
jul. 25
4573
1
jun. 25
2023
2
jun. 25
644