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

Handling (click) event inside sortable template

10 Answers 672 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Brian Vallelunga
Top achievements
Rank 1
Brian Vallelunga asked on 28 Feb 2019, 05:07 PM

I can't seem to handle a click event inside of a sortable object. Is this possible? My code looks like:

            <kendo-sortable [kendoSortableBinding]="selectedColumns" [animation]='true' (dragEnd)='onDragEnd($event)' >
                <ng-template let-column="item">
                    <div class="selected-column">
                        <span draggable="true" class="k-icon k-i-handler-drag"></span>
                        <span style="flex-grow: 1">{{ column.displayName }}</span>
                        <span (click)="removeSelectedColumn(column)" class="k-icon k-i-close" style="cursor: pointer;"></span>
                    </div>
                </ng-template>
            </kendo-sortable>

 

The remove span click event never fires. What's the workaround?

10 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 04 Mar 2019, 08:47 AM
Hello,

The click handler seems to work in this example. Am I missing something?

Regards,
Daniel
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Brian Vallelunga
Top achievements
Rank 1
answered on 13 Mar 2019, 01:48 AM
That's literally the same code we're running. If I figure out what's different, I'll post back.
0
Robert
Top achievements
Rank 1
answered on 23 Aug 2019, 02:20 PM

Hi,

we have the same problem:  a clickhandler is never called, but instead always the dragEnd handler.

This is the difference between the code of the thread starter and the code provided in the stackblitz example.

How can we make the clickhandler working inside a sortable with a dragEnd handler defined?

0
Daniel
Telerik team
answered on 26 Aug 2019, 10:26 AM
Hello,

The click handler seems to be called with dragEnd handler attached - updated example. Am I missing something?

Regards,
Daniel
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Robert
Top achievements
Rank 1
answered on 26 Aug 2019, 11:21 AM

Hi,

thanks for the update.

As we can see now, the dragEnd handler is called before the click handler (same in our impl.) In our impl. we do a server call when the element was dropped.

So we just check in the dragEnd handler

if (dragEndEvent.index !== dragEndEvent.oldIndex) {

 

and can fullfil the requirements. But this a workaround. Is there any way to avoid the call to the dragEnd handler on an onClick event?

Kind regards

 

 

 

 

 

 

0
Robert
Top achievements
Rank 1
answered on 26 Aug 2019, 02:20 PM

Hi,

what i've posted above seems not working, please also look here

0
Daniel
Telerik team
answered on 27 Aug 2019, 10:33 AM
Hello again,

Both issues seem like a bug. We will look into it and I will follow up here once there is more information or a fix.

Regards,
Daniel
Progress Telerik
Get quickly onboarded and successful with your Telerik and Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Daniel
Telerik team
answered on 28 Aug 2019, 08:58 AM
Hi,

Please try with the latest dev version - updated example. Both issues should be fixed.

Regards,
Daniel
Progress Telerik
Get quickly onboarded and successful with your Telerik and Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Robert
Top achievements
Rank 1
answered on 30 Aug 2019, 02:44 PM

Hi,

thanks, i can confirm that in the current dev-version the ondragend handler is not called anymore on the onclick event.

When can we expect a new release?

Kind regards

0
Dimiter Topalov
Telerik team
answered on 03 Sep 2019, 07:48 AM

Hello Christian,

We just released the 3.0.1 version of the Sortable package that contains the discussed fix. It should be already available via NPM.

Regards,
Dimiter Topalov
Progress Telerik

Get quickly onboarded and successful with your Telerik and Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
General Discussions
Asked by
Brian Vallelunga
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Brian Vallelunga
Top achievements
Rank 1
Robert
Top achievements
Rank 1
Dimiter Topalov
Telerik team
Share this question
or