コンテンツへスキップ
メニュー
この質問にフラグが付けられました
7 返信
11626 ビュー

how to use t-foreach in qweb, i add the https://doc.openerp.com/trunk/web/qweb/ example

it show ' No enumerator given to foreach' where is wrong .?

アバター
破棄

I got the same error. Had you make it down ?

著作者

yes, i think you can use exit addon app to change instead of create new

最善の回答

You may have forgotten to add the field on which you want to iterate before your template in your kanban.

アバター
破棄

I had the same problem but now i've solve it. I share my code hoping that it will be helpfull (sorry for my poor english) : <ol> <li t-foreach="widget.categories" t-as="category"> <img class="oe_hr_responsive_category" t-att-src="widget.get_image_url(category)" /> </li> </ol>

I have the same error. Since there is many people asking this question I suspect a bug, here is the bug report : https://bugs.launchpad.net/openobject-addons/+bug/1301474

最善の回答

Please look at my bug ticket on Launchpad : https:// bugs.launchpad.net/openobject-addons/+bug/1301474?comments=all (It was finally not a bug).

You need to initialize the variable in _init, otherwise the foreach will not find it. Exemple :

init: function (field_manager, node) {
    this._super(field_manager, node);
    this.votes = [];
},

start: function() {
    this._super();
    this.votes = ["test", "test"]; //this.get('value');
},
アバター
破棄
関連投稿 返信 ビュー 活動
1
7月 25
2020
1
5月 25
2212
1
4月 25
2522
1
2月 25
1806
0
10月 24
1533