This is a migrated thread and some comments may be shown as answers.

Content into sortable

3 Answers 120 Views
Sortable
This is a migrated thread and some comments may be shown as answers.
Vladislav
Top achievements
Rank 1
Vladislav asked on 27 Apr 2020, 04:47 PM

I have a question. How to add content through TemplateRef to Sortable/Kendo. For example, I want to render several Windows. I can do that? Or is it for text only?

 

<kendo-sortable [kendoSortableBinding]="[contentTemplates]" class="row">

<ng-template let-item="item">
    {{item.templateRef}}
</ng-template>

</kendo-sortable>

 

contentTemplates - It is QueryList Templates

 
 
 
 
 

3 Answers, 1 is accepted

Sort by
0
Vladislav
Top achievements
Rank 1
answered on 27 Apr 2020, 04:49 PM
I have a question. How to add content through TemplateRef to Sortable/Kendo. For example, I want to render several Windows. I can do that? Or is it for text only?
0
Svet
Telerik team
answered on 29 Apr 2020, 11:24 AM

Hi Vladislav,

I am not sure that I understand the requirement.

In general, any Angular component that has a template can be rendered inside an ng-template. Please check the following example demonstrating such approach where a custom Angular component is rendered within the the ng-template of the Sortable component:

https://stackblitz.com/edit/angular-wxqvqq?file=app%2Fapp.component.ts

Adding a TemplateRef to an ng-template doesn't seem to an intended usage of the framework.

Please let me know in case any further details or information is required for this case. Thank you.

Regards,
Svetlin
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Vladislav
Top achievements
Rank 1
answered on 07 May 2020, 08:29 AM

Hi Svetlin,

I found a solution

It is example:

    <kendo-sortable
      [kendoSortableBinding]="palettes">

    <ng-template let-item="item">
      <ng-container *ngIf="contentTemplates">
        <ng-container *ngTemplateOutlet="getTemplateByIndex(item)"></ng-container>
       </ng-container>
     </ng-template>
   </kendo-sortable>

I pass an array of contents to this component and get them through @ContentChildren contentTemplates.

Then I generate an array of indices.

And display that .

Tags
Sortable
Asked by
Vladislav
Top achievements
Rank 1
Answers by
Vladislav
Top achievements
Rank 1
Svet
Telerik team
Share this question
or