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

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');
},
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.ค. 25
2015
1
พ.ค. 25
2202
QWeb: use t-if to check birthday date แก้ไขแล้ว
1
เม.ย. 25
2518
1
ก.พ. 25
1804
0
ต.ค. 24
1532