콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
4 답글
10706 화면

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.  

아바타
취소
베스트 답변

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>
아바타
취소
작성자

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


베스트 답변

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> 


아바타
취소

thank you!

관련 게시물 답글 화면 활동
3
5월 23
14750
0
12월 21
2460
0
2월 25
506
2
12월 24
6652
2
11월 24
26899