Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sample data for the Kendo UI for Angular 2 Sortable demo
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
title = 'Sortable Demo';
groups = [];
ungroupedContacts = [];
constructor() {
this.groups = this.getContacts()
.filter(c => c.group != "Ungrouped");
this.ungroupedContacts = this.getContacts()
.filter(c => c.group == "Ungrouped")[0].people;
}
private getContacts() {
return [
{
group: "Friends",
people: [
{
id: 6,
name: "Todd Motto",
location: "London"
},
{
id: 9,
name: "Ed Charbeneau",
location: "Louisville"
}
]
},
{
group: "Teams",
people: [
{
id: 3,
name: "Mary Jane",
location: "Sofia"
},
{
id: 4,
name: "Linda Belcher",
location: "Orlando"
}
]
},
{
group: "Ungrouped",
people: [
{
id: 1,
name: "Sarah Smith",
location: "New York"
},
{
id: 2,
name: "Ron Burgundy",
location: "Boston"
},
{
id: 5,
name: "Morty Smith",
location: "Boston"
},
{
id: 7,
name: "Rick Sanchez",
location: "Boston"
}
]
}
];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment