Can the part name of a replaceable template be dynamic/bound?

I’ve been trying to use part.bind on a template that is replaceable, but with no success.

What I’ve resorted to is this (within a dynamic html table custom element)

<td repeat.for="c of columns">

	<template if.bind="$index === 0" replaceable part="cell-1">
		${ item[c.property] }
	</template>
	<template if.bind="$index === 1" replaceable part="cell-2">
		${ item[c.property] }
	</template>
	<template if.bind="$index === 2" replaceable part="cell-3">
		${ item[c.property] }
	</template>
    /.../
	<template if.bind="$index === 9" replaceable part="cell-10">
		${ item[c.property] }
	</template>
					
</td>

And I can now replace the contents of a table cell with a custom template using its position in the table (supporting up to 10 columns);

<my-table-component items.bind="dataArray">

    <column property="name" /.../>
    <column property="description" /.../>
    <column property="age" /.../>
	    /.../
    <column property="email" /.../>

    <template replace-part="cell-2">
    	    My custom content: ${ item.description }
    </template>

</my-table-component>

But what I would like to do is something like this;

<td repeat.for="c of columns">

	<template replaceable part.bind="c.property">
		${ item[c.property] }
	</template>
					
</td>

And then provide a custom template for a specific column using the columns property name;

<my-table-component items.bind="dataArray">

    <column property="name" /.../>
    <column property="description" /.../>
    <column property="age" /.../>
    /.../
    <column property="email" /.../>

    <template replace-part="description">
	    My custom content: ${ item.description }
    </template>

</my-table-component>

Is this possible in some way that I just can’t think of?

1 Like

It’s not yet implemented in v1, and we probably won’t be extending it this way. I think your workaround is good for now.

We may be able to provide dynamic destination name if desirable for <au-slot/> (v2 equivalence of replaceable/part)

cc @Sayan751