Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nesting help #6

Open
grosch opened this issue Aug 4, 2016 · 0 comments
Open

Nesting help #6

grosch opened this issue Aug 4, 2016 · 0 comments

Comments

@grosch
Copy link

grosch commented Aug 4, 2016

I have a template like so:

<table border="1" class="alternate">
    <thead style="background-color: #aaa8f0">
        <th>Station Name</th>
        {{#each abbrevs}}
        <th>{{name}}</th>
        {{/each}}
    </thead>
    <tbody>
        {{#each orders}}
        <tr>
           <td>{{station}}</td>
        </tr>
        {{/each}}
    </tbody>
</table>

And then my data model has something like this:

{
  "abbrevs" : [
     { "name" : "ud" },
    { "name" : "dp" }
  ],
  "orders: [
     {
        "station" : "...",
       "ud" : 1,
       "dp" 2
    },
    {
      ...
    }
  ]
}

So in the headers I'm adding a column for each of the abbrevs names. Now, when I'm looping through my orders, I'm not sure how to put the proper value in the proper column for the order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant