Famous / Famous/framework

nested $repeats and $index values

Open
#70 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
394
Forks
62
PR merge metrics
No merged PRs in 30d

Description

Question: Who has an idea how i can get a parent $index value inside a child $repeat?

as in a html structure like

```
// first repeat - thinks rows
// second repeat -- think columns

```

and .js

behaviors: {

.cluster': {

```
'$repeat': function(s_array) {
var result = [];
for (var i = 0; i < s_array.length; i++) { result.push({}); }
return result;
},
'position': function($index)
return [ s_array[$index][1], ];
},
```

},
'.particle': {

```
'$repeat': function(s_array) {
var result = [];
for (var i = 0; i < s_array[PARENTINDEX][2]; i++) { result.push({}); }
return result;
},
'position': function() {
return [$index, 0];
},
```

},

states: {

```
s_array : [[1,11,8],[2,9,13],[2,9,23],[3,7,13],[4,6,19],[5,5,19],[6,4,8],[6,19,5],[7,4,7],[7,21,2],[8,4,6]]
```

}

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.