Skip to content

Instantly share code, notes, and snippets.

@adriatic
Last active July 20, 2016 06:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save adriatic/ba1d5c88b1c08537f62f1f4d05aac6c3 to your computer and use it in GitHub Desktop.
Save adriatic/ba1d5c88b1c08537f62f1f4d05aac6c3 to your computer and use it in GitHub Desktop.
DropDownList: Api
<template>
<div id="example">
<div class="demo-section k-content">
<h4>Select movie</h4>
<ak-drop-down-list k-data-text-field="text"
k-data-value-field="value"
k-data-source.bind="data"
k-height.bind="100"
k-widget.two-way="movies"
style="width: 100%;">
</ak-drop-down-list>
</div>
<div class="box wide">
<div class="box-col">
<h4>API Functions</h4>
<ul class="options">
<li>
<button click.delegate="movies.enable()" class="k-button">Enable</button>
<button click.delegate="movies.enable(false)" class="k-button">Disable</button>
</li>
<li>
<button click.delegate="movies.readonly()" class="k-button">Readonly</button>
</li>
<li>
<button click.delegate="movies.open()" class="k-button">Open</button>
<button click.delegate="movies.close()" class="k-button">Close</button>
</li>
<li>
<button click.delegate="getValue()" class="k-button">Get value</button>
<button click.delegate="getText()" class="k-button">Get text</button>
</li>
</ul>
</div>
<div class="box-col">
<h4>Selection</h4>
<ul class="options">
<li>
<input ref="indexInput" value="0" class="k-textbox" style="width: 40px; margin: 0;" />
<button click.delegate="setIndex(indexInput.value)" class="k-button">Select by index</button>
</li>
<li>
<input ref="valueInput" value="1" class="k-textbox" style="width: 40px; margin: 0;" />
<button click.delegate="setValue(valueInput.value)" class="k-button">Select by value</button>
</li>
<li>
<input ref="wordInput" value="Pulp" class="k-textbox" style="width: 100px; margin: 0;" />
<button click.delegate="setSearch(wordInput.value)" class="k-button">Select item starting with</button>
</li>
</ul>
</div>
</div>
</div>
<style>
.configuration .k-textbox {
width: 40px;
}
.k-button {
min-width: 80px;
}
</style>
</template>
export class Api {
data = [{
text: 'The Shawshank Redemption',
value: '1'
}, {
text: 'The Godfather',
value: '2'
}, {
text: 'The Godfather: Part II',
value: '3'
}, {
text: 'Il buono, il brutto, il cattivo.',
value: '4'
}, {
text: 'Pulp Fiction',
value: '5'
}, {
text: '12 Angry Men',
value: '6'
}, {
text: 'Schindler\'s List',
value: '7'
}, {
text: 'One Flew Over the Cuckoo\'s Nest',
value: '8'
}, {
text: 'Inception',
value: '9'
}, {
text: 'The Dark Knight',
value: '10'
}];
getValue() {
alert(this.movies.value());
}
getText() {
alert(this.movies.text());
}
setValue(val) {
this.movies.value(val);
}
setIndex(val) {
let index = parseInt(val, 8);
this.movies.select(index);
}
setSearch(val) {
this.movies.search(val);
}
}
<!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