Skip to content

Instantly share code, notes, and snippets.

@adriatic
Last active July 20, 2016 06:37
Show Gist options
  • Save adriatic/6296a1bc586c1c9131b1b955a8510351 to your computer and use it in GitHub Desktop.
Save adriatic/6296a1bc586c1c9131b1b955a8510351 to your computer and use it in GitHub Desktop.
Scheduler: timeline view
<template>
<div id="example" class="k-content">
<ak-scheduler k-date.bind="date"
k-start-time.bind="startTime"
k-event-height.bind="50"
k-major-tick.bind="60"
k-views.bind="views"
k-timezone="Etc/UTC"
k-data-source.bind="datasource"
k-group.bind="{
resources: ['Rooms', 'Attendees'],
orientation: 'vertical'
}"
k-resources.bind="resources">
</ak-scheduler>
</div>
</template>
export class TimelineView {
date = new Date('2013/6/13');
startTime = new Date('2013/6/13 07:00 AM');
resources = [{
field: 'roomId',
name: 'Rooms',
dataSource: [
{ text: 'Meeting Room 101', value: 1, color: '#6eb3fa' },
{ text: 'Meeting Room 201', value: 2, color: '#f58a8a' }
],
title: 'Room'
},
{
field: 'attendees',
name: 'Attendees',
dataSource: [
{ text: 'Alex', value: 1, color: '#f8a398' },
{ text: 'Bob', value: 2, color: '#51a0ed' },
{ text: 'Charlie', value: 3, color: '#56ca85' }
],
multiple: true,
title: 'Attendees'
}];
views = [
'timeline',
'timelineWeek',
'timelineWorkWeek',
{
type: 'timelineMonth',
startTime: new Date('2013/6/13 00:00 AM'),
majorTick: 1440
}
];
datasource = {
batch: true,
transport: {
read: {
url: '//demos.telerik.com/kendo-ui/service/meetings',
dataType: 'jsonp'
},
update: {
url: '//demos.telerik.com/kendo-ui/service/meetings/update',
dataType: 'jsonp'
},
create: {
url: '//demos.telerik.com/kendo-ui/service/meetings/create',
dataType: 'jsonp'
},
destroy: {
url: '//demos.telerik.com/kendo-ui/service/meetings/destroy',
dataType: 'jsonp'
},
parameterMap: function(options, operation) {
if (operation !== 'read' && options.models) {
return { models: kendo.stringify(options.models) };
}
}
},
schema: {
model: {
id: 'meetingID',
fields: {
meetingID: { from: 'MeetingID', type: 'number' },
title: { from: 'Title', defaultValue: 'No title', validation: { required: true } },
start: { type: 'date', from: 'Start' },
end: { type: 'date', from: 'End' },
startTimezone: { from: 'StartTimezone' },
endTimezone: { from: 'EndTimezone' },
description: { from: 'Description' },
recurrenceId: { from: 'RecurrenceID' },
recurrenceRule: { from: 'RecurrenceRule' },
recurrenceException: { from: 'RecurrenceException' },
roomId: { from: 'RoomID', nullable: true },
attendees: { from: 'Attendees', nullable: true },
isAllDay: { type: 'boolean', from: 'IsAllDay' }
}
}
}
};
}
<!doctype html>
<html>
<head>
<title>Aurelia KendoUI bridge</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2016.1.226/styles/kendo.common.min.css">
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2016.1.226/styles/kendo.rtl.min.css">
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2016.1.226/styles/kendo.default.min.css">
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2016.1.226/styles/kendo.mobile.all.min.css">
<script src="https://kendo.cdn.telerik.com/2016.1.226/js/jszip.min.js"></script>
</head>
<body aurelia-app="main">
<h1>Loading...</h1>
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.6/system.js"></script>
<script src="https://rawgit.com/aurelia-ui-toolkits/aurelia-kendoui-bundles/0.3.5/config2.js"></script>
<script>
System.import('aurelia-bootstrapper');
</script>
</body>
</html>
export function configure(aurelia) {
aurelia.use
.standardConfiguration()
.developmentLogging()
.plugin('aurelia-kendoui-bridge', kendo => kendo.pro());
aurelia.start().then(a => a.setRoot());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment