When updating data input of Kendo Sortable component, it currently destroys and re-renders dom for all items. That leads to "flickering" view and bad performance.
Example
// pseudocode
@Component(template: <kendo-sortable [data]="data"></kendo-sortable>)
class MyComponent {
data = [obj1, obj2, … obj200];
updateData() {
this.data = [...this.data];
}
}
Expected
When I call updateData() sortable dom should not be modified. All items are the same (same object reference) and so angular should keep the dom.
Current behavior
When I call updateData() kendo Sortable will destroy the dom and re-render all items.
Notes
The reason seems to be, that SortableComponent maps all items to an internal _localData array that adds a container element to each item. These container elements are always new objects and so Angular *ngFor will re-render everything. There's also no option to provide a custom trackBy callback.
Our scenario: We use kendo Sortable for a field mapping component that allows users to map CSV files to our database structure. Every user interaction will lead to a new array of mappings and so... every user input leads to a full re-rendering of some 100 form rows now...
Hello,
I'd like the angular package has got the same feature provided by the query package
https://docs.telerik.com/kendo-ui/api/javascript/ui/sortable/configuration/holdtodrag
Regards AL
Sometimes we're using kendo sortable to sort "panels" containing form elements.
Examples:
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>
Support selecting multiple items to be dragged/dropped.
I'm currently stuck at v12.1 of the Layout module, because there are some breaking changes after that that doesn't allow me to add elements between the tab titles and the tab content. <kendo-tabstrip> <div> Static stuff that will be displayed for every tab, between the tab title and content. </div> <kendo-tabstrip-tab> ... </kendo-tabstrip-tab> <kendo-tabstrip-tab> ... </kendo-tabstrip-tab> </kend-tabstrip> This is working in v12.1, but not after that. In the newest version, the "static elements" are ignore/removed from the HTML. Related Github ticket: https://github.com/telerik/kendo-angular2/issues/97
Bound array on a kendo-sortable should update with no extra code