Skip to content

Instantly share code, notes, and snippets.

@adriatic

adriatic/app.html

Last active Oct 4, 2016
Embed
What would you like to do?
DropDownList:customizing templates
<template>
<require from="./customizing-templates.css"></require>
<div id="example">
<div class="demo-section k-content">
<h4>Customers</h4>
<ak-drop-down-list k-data-text-field="ContactName"
k-data-value-field="CustomerID"
k-height="400"
k-data-source.bind="dataSource"
id="dropdownlist-customizing-templates-customers"
style="width: 100%">
<ak-template for="headerTemplate">
<div class="dropdown-header k-widget k-header">
<span>Photo</span>
<span>Contact info</span>
</div>
</ak-template>
<ak-template>
<span class="k-state-default" style="background-image: url('http://demos.telerik.com/kendo-ui/content/web/Customers/${CustomerID}.jpg')"></span>
<span class="k-state-default">
<h3>${ContactName}</h3>
<p>${CompanyName}</p>
</span>
</ak-template>
<ak-template for="valueTemplate">
<span class="selected-value" style="background-image: url('http://demos.telerik.com/kendo-ui/content/web/Customers/${CustomerID}.jpg')"></span>
<span>${ContactName}</span>
</ak-template>
</ak-drop-down-list>
</div>
</div>
</template>
export class CustomizingTemplates {
dataSource = {
transport: {
read: {
dataType: 'jsonp',
url: '//demos.telerik.com/kendo-ui/service/Customers'
}
}
}
}
#dropdownlist-customizing-templates-customers-list .dropdown-header {
border-width: 0 0 1px 0;
text-transform: uppercase;
}
#dropdownlist-customizing-templates-customers-list .dropdown-header > span {
display: inline-block;
padding: 10px;
}
#dropdownlist-customizing-templates-customers-list .dropdown-header > span:first-child {
width: 50px;
}
#dropdownlist-customizing-templates .selected-value {
display: inline-block;
vertical-align: middle;
width: 24px;
height: 24px;
background-size: 100%;
margin-right: 5px;
border-radius: 50%;
}
#dropdownlist-customizing-templates-customers-list .k-item {
line-height: 1em;
min-width: 300px;
}
/* Material Theme padding adjustment*/
#dropdownlist-customizing-templates-customers-list .k-material .k-item,
#dropdownlist-customizing-templates-customers-list .k-material .k-item.k-state-hover,
#dropdownlist-customizing-templates-customers-list .k-materialblack .k-item,
#dropdownlist-customizing-templates-customers-list .k-materialblack .k-item.k-state-hover {
padding-left: 5px;
border-left: 0;
}
#dropdownlist-customizing-templates-customers-list .k-item > span {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
display: inline-block;
vertical-align: top;
margin: 20px 10px 10px 5px;
}
#dropdownlist-customizing-templates-customers-list .k-item > span:first-child {
-moz-box-shadow: inset 0 0 30px rgba(0,0,0,.3);
-webkit-box-shadow: inset 0 0 30px rgba(0,0,0,.3);
box-shadow: inset 0 0 30px rgba(0,0,0,.3);
margin: 10px;
width: 50px;
height: 50px;
border-radius: 50%;
background-size: 100%;
background-repeat: no-repeat;
}
#dropdownlist-customizing-templates-customers-list h3 {
font-size: 1.2em;
font-weight: normal;
margin: 0 0 1px 0;
padding: 0;
}
#dropdownlist-customizing-templates-customers-list p {
margin: 0;
padding: 0;
font-size: .8em;
}
<!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