Reputation: 9184
In my first angular app i have such data:
tree_rows = [{"level":1,"branch":{"Name":"USA","Area":9826675,"Population":318212000,"TimeZone":"UTC -5 to -10","children":[{"Name":"California","Area":423970,"Population":38340000,"TimeZone":"Pacific Time","children":[{"Name":"San Francisco","Area":231,"Population":837442,"TimeZone":"PST"},{"Name":"Los Angeles","Area":503,"Population":3904657,"TimeZone":"PST"}]},{"Name":"Illinois","Area":57914,"Population":12882135,"TimeZone":"Central Time Zone","children":[{"Name":"Chicago","Area":234,"Population":2695598,"TimeZone":"CST"}]}],"level":1,"expanded":true,"uid":"0.5810681234579533","Options":[]},"label":"USA","tree_icon":"icon-file glyphicon glyphicon-file fa fa-file","visible":true},{"level":1,"branch":{"Name":"Texas","Area":268581,"Population":26448193,"TimeZone":"Mountain","level":1,"expanded":true,"uid":"0.8260199765209109","Options":[]},"label":"Texas","tree_icon":"icon-file glyphicon glyphicon-file fa fa-file","visible":true}]
colDefinitions = [{"field":"Area"},{"field":"Population"},{"field":"TimeZone"},{"field":"children"}]
and i try to view it via table-grid-view:
<tr ng-repeat=\"row in tree_rows | filter:{visible:true} track by row.branch.uid\"
ng-class=\"'level-' + {{ row.level }} + (row.branch.selected ? ' active':'')\" class=\"tree-grid-row\">
<td class=\"text-primary\"><a ng-click=\"user_clicks_branch(row.branch)\"><i ng-class=\"row.tree_icon\"
ng-click=\"row.branch.expanded = !row.branch.expanded\"
class=\"indented tree-icon\"></i>
</a><span class=\"indented tree-label\" ng-click=\"user_clicks_branch(row.branch)\">
{{row.branch[expandingProperty]}}</span>
</td>
<td ng-repeat=\"col in colDefinitions\">{{row.branch[col.field]}}</td> - this line!!!
</tr>
and all is ok, just that i want to display not all data as: <td ng-repeat=\"col in colDefinitions\">{{row.branch[col.field]}}</td>
but for example {{row.branch[Name]}} , {{row.branch[Population]}}
and there i didn't see any data. But why?
How to get data from my array via field?
ps: i use this: https://github.com/khan4019/tree-grid-directive/blob/master/README.md
Upvotes: 0
Views: 1245