Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
3733 Переглядів

I have the following template:

<t t-name='test_template'>
     <t t-call="other_template"/>
</t>

And I have the following code:

alert(data['items'].length);
var html = $(this.qweb.render("test_template", {'data' : data}));
alert(data['items'].length);


The first alert is showing 30. The second one is showing 1.

Why is the template renderer changing the object reference passed as data?

This only happens when using sub-template calling.

Аватар
Відмінити
Автор Найкраща відповідь

It was my own fault. The problem was in another template.

I had somethine like this:

<t t-if="items.length > 1">

And I the correct code is:

<t t-if="items.length &gt; 1">

">" is a special character in xml.

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
0
бер. 15
3864
0
квіт. 25
1500
0
січ. 24
1697
2
лют. 24
15362
4
квіт. 24
20580