From 0015b2fc2271b47834f33f60b6324f8a499d69b6 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 28 Jun 2018 13:10:50 +0200 Subject: [PATCH] matrix: use "$" instead of "i" to represent the index (#320) --- resources/docs/widgets/matrices.md | 2 +- src/browser/js/app/widgets/matrices/matrix.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/docs/widgets/matrices.md b/resources/docs/widgets/matrices.md index f13ed586..2aeab2e6 100644 --- a/resources/docs/widgets/matrices.md +++ b/resources/docs/widgets/matrices.md @@ -37,7 +37,7 @@ Creates grid of widgets of a given type ### `props` - type: `object` - default: `{}` -- usage: define a set of property to override the widgets' defaults. [Formulas](../extras/advanced-property-syntax/#formulas) in this field are resolved with an extra variable `i` representing each widget's index +- usage: define a set of property to override the widgets' defaults. [Formulas](../extras/advanced-property-syntax/#formulas) in this field are resolved with an extra variable `$` representing each widget's index diff --git a/src/browser/js/app/widgets/matrices/matrix.js b/src/browser/js/app/widgets/matrices/matrix.js index 1f976e65..6325298b 100644 --- a/src/browser/js/app/widgets/matrices/matrix.js +++ b/src/browser/js/app/widgets/matrices/matrix.js @@ -95,10 +95,10 @@ class Matrix extends _matrix_base { var hashes = [...this.childrenHashes] this.childrenHashes = [] - for (var i in hashes) { + for (var i = 0; i < hashes.length; i++) { let widget = widgetManager.widgets[hashes[i]], - data = this.resolveProp('props', undefined, false, false, false, {'i':i}) + data = this.resolveProp('props', undefined, false, false, false, {'$':i}) Object.assign(widget.props, data) widget.updateProps(Object.keys(data), this)