AnsweredAssumed Answered

Sidecar nesting partials

Question asked by Jeroen Somhorst on Sep 7, 2019

Since sidecar is using handlebars I thought it wouldn't be a difficult task to create a ul/li structure with multiple levels. I was so wrong. For some reason I need to use a sidecar specific 'partial' helper that retrieves the partial that I need and renders it. 

 

I have the following structure: 

[
  {
    "id": "1",
    "name": "hello",
    "children": [
      {
        "id": "2",
        "name": "world",
        "children": [
          {
            "id": "3",
            "name": "apple",
            "children": [
             
            ]
          }
        ]
      }
    ]
  }
]

nothing to fancy. 

 

So I started of with a simple

{{#each}}

<b>{{name}}</b>

{{#each children}}

  {{ partial 'rowtemplatename' ../this this}}

{{/each}}

{{/each}}

 

this does not seem to work since the '../this\ in the first nested level returns the current entry in the above loop and not the component we are in. therefore the partial helper crashes out. Is it even possible with the sidecar handlebars changes to create a nested table / list structure?

Outcomes