From 4a2d01916111794c35e0bff3c4abbd42a053d394 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Mon, 19 Oct 2020 16:46:00 +0200 Subject: [PATCH] [DOC] qweb: explain how to work with iterables in t-foreach Owl is meant to stay low level-ish, and making it work magically with sets/maps/... seems to be a little too much in term of code/magic. Also, using iterables in t-foreach is actually quite simple, making this improvement not as important. closes #720 closes #754 --- doc/reference/qweb_templating_language.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc/reference/qweb_templating_language.md b/doc/reference/qweb_templating_language.md index b1d910c5..e468984d 100644 --- a/doc/reference/qweb_templating_language.md +++ b/doc/reference/qweb_templating_language.md @@ -453,6 +453,17 @@ are all equivalent: If there is no `t-key` directive, Owl will use the index as a default key. +Note: the `t-foreach` directive only accepts arrays (lists) or objects. It does +not work with other iterables, such as `Set`. However, it is only a matter of +using the `...` javascript operator. For example: + +```xml +... +``` + +The `...` operator will convert the `Set` (or any other iterables) into a list, +which will work with Owl QWeb. + ### Rendering Sub Templates QWeb templates can be used for top level rendering, but they can also be used