Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
4738 มุมมอง

What is the ideal way to select an element that is inside of if-else statements? For example, if in a qweb view, there is a statement that says something like:

t-if="something"

INFORMATION


t-else-if="somethingElse"

SOME OTHER INFROMATION

(I can't write div or p here for some reason, consider that those two strings are inside of a div)

Now, what is the ideal way to write an XPath expression that modifies both? If I do //div[1] and then //div[2], it says it can't find the second element, which is true I guess because it'll only be there if the second condition is true. However, that'll also make it //div[1], no? But if I only do //div or //div[1], it doesn't affect the second one, even when the second condition is true. What am I missing here? 

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi Sean Craig


To target the element in "t-if" and in "t-else" use the below expression in you xpath tag

Please find code in comment. 

Feel free to contact us for further assistance

Hope this answer helps you.

Thanks & Regards,
Email: odoo@aktivsoftware.com     

Skype: kalpeshmaheshwari

อวตาร
ละทิ้ง

Please find code here :-

For t-if : expr="//t[@t-if='something']"
For t-else : expr="//t[@t-else='somethingElse']"

คำตอบที่ดีที่สุด

Hi,

You can also include the t-if or t-else conditions in the xpath path

Here is an example
If you need to use t-if in the xpath

<xpath expr="//t[@t-if='condition']" position="before">
   //add your values
</xpath>

OR

If you need to use t-else in the xpath
<xpath expr="//t[@t-else='condition']" position="before">
//add your values
</xpath>

Hope it helps

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
มี.ค. 24
2808
1
ธ.ค. 23
2492
2
ก.พ. 16
8774
1
มี.ค. 24
1745
0
มี.ค. 24
977