Skip to content

Instantly share code, notes, and snippets.

@adriatic
Last active July 20, 2016 06:37
Show Gist options
  • Save adriatic/3ec4451fbd0cd5feecdce23816feb2ef to your computer and use it in GitHub Desktop.
Save adriatic/3ec4451fbd0cd5feecdce23816feb2ef to your computer and use it in GitHub Desktop.
Scheduler: event move and resize
<template>
<div id="example">
<div class="box wide">
<div class="box-col">
<label><input type="checkbox" checked.bind="snap" change.delegate="snapChanged()">Snap events to slot boundaries</label>
</div>
</div>
<ak-scheduler k-date.bind="date"
k-start-time.bind="startTime"
k-height.bind="600"
k-views.bind="[
'day',
{ type: 'week', selected: true },
'timeline'
]"
k-timezone="Etc/UTC"
k-data-source.bind="dataSource"
k-widget.bind="scheduler"></ak-scheduler>
</div>
</template>
export class EventModeAndResize {
snap = true;
date = new Date('2013/6/13');
startTime = new Date('2013/6/13 07:00 AM');
snapChanged() {
this.scheduler.options.snap = this.snap;
this.scheduler.view(this.scheduler.view().name);
}
dataSource = {
batch: true,
transport: {
read: {
url: '//demos.telerik.com/kendo-ui/service/tasks',
dataType: 'jsonp'
},
update: {
url: '//demos.telerik.com/kendo-ui/service/tasks/update',
dataType: 'jsonp'
},
create: {
url: '//demos.telerik.com/kendo-ui/service/tasks/create',
dataType: 'jsonp'
},
destroy: {
url: '//demos.telerik.com/kendo-ui/service/tasks/destroy',
dataType: 'jsonp'
},
parameterMap: function(options, operation) {
if (operation !== 'read' && options.models) {
return {models: kendo.stringify(options.models)};
}
}
},
schema: {
model: {
id: 'taskId',
fields: {
taskId: { from: 'TaskID', 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' },
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