Search code examples
angularkendo-ui-angular2

Kendo UI Angular 2 Sortable Methods


How does one use the Methods of Kendo UI for Angular 2's Sortable component?

The documentation doesn't present any specific examples.


Solution

  • Answering for future users.

    Import:

    import {SortableComponent} from '@progress/kendo-angular-sortable';
    

    Include:

    export class ComponentName implements OnInit {
    
        @ViewChild('sortable') public sortable: SortableComponent;
        ...
    
    }
    

    Call:

    public addDataItemFunction() {
        this.sortable.addDataItem('1', 0);
    }
    

    "addDataItem" being the Method.

    Element:

    <kendo-sortable #sortable ...></kendo-sortable>
    

    Hope this helps.