mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] compiler: t-model supports radio group in t-foreach
Have a radio group defined inside a t-foreach:
```xml
<t t-foreach="values" t-as="val" t-key="val">
<input name="radiogroup" t-att-value="val" t-model="state.radioGroup" />
</t>
```
Before this commit the algorithm that set the "checked" attribute on the current active
radio button according to the state did not support having a dynamic value (`t-att-value`)
After this commit, this use case works as we go look in the dynamic attributes too.
This commit is contained in:
committed by
Géry Debongnie
parent
a69f8a39e7
commit
cea82e945d
@@ -632,7 +632,15 @@ export class CodeGenerator {
|
||||
|
||||
let idx: number;
|
||||
if (specialInitTargetAttr) {
|
||||
idx = block!.insertData(`${fullExpression} === '${attrs[targetAttr]}'`, "attr");
|
||||
let targetExpr = targetAttr in attrs && `'${attrs[targetAttr]}'`;
|
||||
if (!targetExpr && ast.attrs) {
|
||||
// look at the dynamic attribute counterpart
|
||||
const dynamicTgExpr = ast.attrs[`t-att-${targetAttr}`];
|
||||
if (dynamicTgExpr) {
|
||||
targetExpr = compileExpr(dynamicTgExpr);
|
||||
}
|
||||
}
|
||||
idx = block!.insertData(`${fullExpression} === ${targetExpr}`, "attr");
|
||||
attrs[`block-attribute-${idx}`] = specialInitTargetAttr;
|
||||
} else if (hasDynamicChildren) {
|
||||
const bValueId = generateId("bValue");
|
||||
|
||||
Reference in New Issue
Block a user