Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
3000 Weergaven

Any clue how to modify below div to include by inharitance following <li> tag?

<li><a href="#" class="field-selection" t-att-data-field-id="field.id" t-att-data-id="header_id"

            t-att-data-interval="'hour'">Hour</a></li>    :



<div t-name="field_selection" class="dropdown">

<span class="btn btn-default field-selection dropdown-toggle" data-toggle="dropdown"></span>

      <ul class="dropdown-menu multi-level" role="menu">

  <t t-foreach="fields" t-as="field">

             <t t-if="(field.type === 'date') || (field.type === 'datetime')">

                <li class="graph-dropdown-submenu">

                   <a class="field-selection" t-att-data-field-id="field.id" t-att-data-id="header_id" t-att-

                                data-interval="'month'" href="#">

                      <t t-esc="field.value"/>

                          </a>

                          <ul class="dropdown-menu">

                                <li><a href="#" class="field-selection" t-att-data-field-id="field.id" t-att-data-

                                       id="header_id" t-att-data-interval="'day'">Day</a></li>

                                <li><a href="#" class="field-selection" t-att-data-field-id="field.id" t-att-data- 

                                       id="header_id" t-att-data-interval="'week'">Week</a></li>

                                <li><a href="#" class="field-selection" t-att-data-field-id="field.id" t-att-data-

                                      id="header_id" t-att-data-interval="'month'">Month</a></li>

                                <li><a href="#" class="field-selection" t-att-data-field-id="field.id" t-att-data-

                                      id="header_id" t-att-data-interval="'quarter'">Quarter</a></li>

                        </ul>

                    </li>
                </t>
Avatar
Annuleer
Beste antwoord

Hello Jakub,


You can navigate to the element inside which you want to add extra content by using xpath expr.

Here you can use "t-name" to find the main element and then the child element using "class" inside which you want to append your content.  



<xpath expr="//div[@t-name='field_selection']//ul[contains(@class, 'dropdown-menu')]" position="inside">

<li>

<a href="#" class="field-selection" t-att-data-field-id="field.id" t-att-data-id="header_id" t-att-data-interval="'hour'">

Hour

</a>

</li>

</xpath>


Note: Please make sure that your main element has unique id or class or else it will append the content where ever the path is matched.


Also this code is not tested so you might require minor modifications to the path.

Regards,




Email:   odoo@aktivsoftware.com

Skype: kalpeshmaheshwari

   

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
1
nov. 24
1635
5
jul. 24
92895
1
dec. 23
3048
1
mei 22
3642
0
jan. 20
2892