Skip to content

Instantly share code, notes, and snippets.

@adriatic
Last active August 10, 2016 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save adriatic/9874fbf5283d4f2c6c9c770295c4eca8 to your computer and use it in GitHub Desktop.
Save adriatic/9874fbf5283d4f2c6c9c770295c4eca8 to your computer and use it in GitHub Desktop.
ComboBox: cascading combobox
<template>
<div id="example">
<div class="demo-section k-content">
<h4>Categories:</h4>
<ak-combobox k-option-label="Select category..."
k-data-text-field="CategoryName"
k-data-value-field="CategoryID"
k-widget.bind="categories"
k-data-source.bind="{
type: 'odata',
serverFiltering: true,
transport: {
read: '//demos.telerik.com/kendo-ui/service/Northwind.svc/Categories'
}
}"
id="categories" style="width: 100%;">
</ak-combobox>
<h4 style="margin-top: 2em;">Products:</h4>
<ak-combobox k-auto-bind.bind="false"
k-cascade-from="categories"
k-option-label="Select product..."
k-data-text-field="ProductName"
k-data-value-field="ProductID"
k-widget.bind="products"
k-data-source.bind="{
type: 'odata',
serverFiltering: true,
transport: {
read: '//demos.telerik.com/kendo-ui/service/Northwind.svc/Products'
}
}"
id="products" style="width: 100%;">
</ak-combobox>
<h4 style="margin-top: 2em;">Orders:</h4>
<ak-combobox k-auto-bind.bind="false"
k-cascade-from="products"
k-widget.bind="orders"
k-option-label="Select order..."
k-data-text-field="Order.ShipCity"
k-data-value-field="OrderID"
k-data-source.bind="{
type: 'odata',
serverFiltering: true,
transport: {
read: '//demos.telerik.com/kendo-ui/service/Northwind.svc/Order_Details?$expand=Order'
}
}"
id="orders" disabled="disabled" style="width: 100%;">
</ak-combobox>
<button click.delegate="viewOrder()" ak-button style="margin-top: 2em; float: right;">View Order</button>
</div>
</div>
</template>
export class CascadingDropDownList {
viewOrder() {
let categoryInfo = `\nCategory: { id: ${this.categories.value()}, name: ${this.categories.text()} }`;
let productInfo = `\nProduct: { id: ${this.products.value()}, name: ${this.products.text()} }`;
let orderInfo = `\nOrder: { id: ${this.orders.value()}, name: ${this.orders.text()} }`;
alert(`Order details:\n ${categoryInfo}${productInfo}${orderInfo}`);
}
}
<!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