You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 5, 2018. It is now read-only.
Colleagues, I have a task to create a Glimmer.js component, say, <x-table/>. This component should be exported as Web Component.
The goal is to create unified component that accepts data + config and render all the grid accordingly. Example of config:
Some of the columns contain mix of data and specific html.
This is how I provide data and config to the table: <x-table @data={{ data }} @config={{config}}></x-table>
And this is template of the x-table component:
<table>
<tr>
{{#each @config.columns key="@index" as |column|}}
<th class="{{if column.sortable 'sortable'}}">{{column.heading}}</th>
{{/each}}
</tr>
{{#each @data key="@index" as |model|}}
<tr>
{{#each @config.columns key="@index" as |column|}}
<td>HOW CAN I RENDER TEMPLATE FROM CONFIG HERE?</td>
{{/each}}
</tr>
{{/each}}
</table>
I can't understand how to render dynamic templates. I tried <td>{{partial column.template}}</td>, but the helper requires pre-registered template. I can't find any API how to do this.
Please advise how can I resolve the issue.
IMO
Counting on the fact we address markup in the configuration, as for me, then the solution should look something like this:
@roomle-build we need to wait until contextual components will be implemented. But I think after this there are still some questions because contextual component should be predefined and you can't use custom template. Let's wait and see new capabilities.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Colleagues, I have a task to create a Glimmer.js component, say,
<x-table/>
. This component should be exported as Web Component.The goal is to create unified component that accepts data + config and render all the grid accordingly. Example of config:
Some of the columns contain mix of data and specific html.
This is how I provide data and config to the table:
<x-table @data={{ data }} @config={{config}}></x-table>
And this is template of the x-table component:
I can't understand how to render dynamic templates. I tried
<td>{{partial column.template}}</td>
, but the helper requires pre-registered template. I can't find any API how to do this.Please advise how can I resolve the issue.
IMO
Counting on the fact we address markup in the configuration, as for me, then the solution should look something like this:
But Glimmer.js does not have any API to access children components and read the data.
Similar solutions in different component libraries:
It is still open question how to pass the data as object in Web Component but at least question of configuration might be solved in this way for current example.
The text was updated successfully, but these errors were encountered: