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

Select Event in Sortable

1 Answer 108 Views
Sortable
This is a migrated thread and some comments may be shown as answers.
Sergej
Top achievements
Rank 1
Sergej asked on 18 Nov 2020, 02:26 PM

Hi,

it is possible to find out the item that currently selected or set active by user without drag(event or index).
In my case, i would like to update a neighboring component when the user click an item in the sortable.
Thanks in advance for your answer

1 Answer, 1 is accepted

Sort by
0
Svet
Telerik team
answered on 20 Nov 2020, 09:03 AM

Hi Sergej,

Indeed, the public API of the Sortable component currently doesn't expose an event that is fired when clicking a Sortable item. I am not sure if that will help in your specific use-case scenario, but probably the generic (click) event be used for this case. Please check the following example where I handle the (click) event of each sortable item:

https://stackblitz.com/edit/angular-udzcqf?file=app/app.component.ts

              <kendo-sortable
              [kendoSortableBinding]="palette.data"
              [itemStyle] = "{'border': '0px', 'opacity':'1', 'cursor': 'move'}"
              [emptyItemStyle] = "{'height': '30px', 'border': '2px dashed black'}"
              [activeItemStyle] = "{'border': '2px dashed black', 'opacity':'0.7'}"
              zone="innerZone">
                  <ng-template let-item="item">
                      <div (click)="onClick(item, palette)" [ngStyle]="{'background-color': item,'color': 'white',
                      'height': '30px', 'margin' : '2px', 'border': '1px solid black'}" >
                          {{item}}
                      </div>
                  </ng-template>
              </kendo-sortable>

I hope this helps.

Regards,
Svetlin
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

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