Approved
Last Updated: 22 Aug 2019 12:36 by ADMIN
Created by: Mitchell
Comments: 0
Category: Sortable
Type: Feature Request
0
Please provide an option to change the position of the hint of the dragged item. Currently it is located below the cursor to the right. 
Approved
Last Updated: 03 May 2019 10:40 by ADMIN
Created by: Christoph
Comments: 1
Category: Sortable
Type: Feature Request
0

Sometimes we're using kendo sortable to sort "panels" containing form elements.

Examples:

  • Sortable item with "delete" button
  • Sortable item with "enabled" checkbox

Problem:

The sortable will "catch" the mousdown/pointerdown events and form elements on draggable items will not work.

Solution:

We have to listen in a div for those events and stop propagation.

.. but that needs additional code in template and component. We've created a small directive to do that, but that's an additional module we have to include in each feature module (and we have to remember that it exists, and what was the name, …)

Feature request:

Add a directive to sortable module that allows us to exclude areas inside of sortable items from being draggable to make (form) element work in these areas.

---


import { Directive, ElementRef, OnInit, Renderer2, AfterViewInit } from '@angular/core';

@Directive({
    selector: '[draggableExclude]'
})
export class DraggableExcludeDirective implements AfterViewInit {

    constructor(
        private _elemRef: ElementRef,
        private _renderer: Renderer2,
    ) { }

    ngAfterViewInit() {
        this._renderer.listen(this._elemRef, 'mousedown', (e: MouseEvent) => e.stopPropagation());
        this._renderer.listen(this._elemRef, 'pointerdown', (e: MouseEvent) => e.stopPropagation());
    }
}

Note: Touch is not handled.

… and how we use it


                    <kendo-sortable  … >
                        <ng-template let-attribute="item">
                            <div class="details">
                                {{ attribute.name }}
                            </div>
                            <div draggableExclude>
                                <button kendoButton look="bare" type="button"
                                    (click)="requestDeleteAttribute(attribute)" icon="delete"></button>
                            </div>
                        </ng-template>
                    </kendo-sortable>