Skip to content

Instantly share code, notes, and snippets.

@adriatic
Last active July 20, 2016 06:40
Show Gist options
  • Save adriatic/01b9dc9b41f8f1f42a4e6281f93c5473 to your computer and use it in GitHub Desktop.
Save adriatic/01b9dc9b41f8f1f42a4e6281f93c5473 to your computer and use it in GitHub Desktop.
Multiselect: customizing templates
<template>
<require from="./customizing-templates.css"></require>
<div id="example">
<div class="demo-section wide k-content">
<ak-multiselect k-placeholder="Select customers..."
k-data-text-field="ContactName"
k-data-value-field="CustomerID"
k-height.bind="400"
k-data-source.bind="dataSource"
k-value.bind="value"
id="multiselect-customizing-templates-customers">
<ak-template for="headerTemplate">
<div class="dropdown-header k-widget k-header">
<span>Photo</span>
<span>Contact info</span>
</div>
</ak-template>
<ak-template for="itemTemplate">
<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="tagTemplate">
<span class="selected-value" style="background-image: url('../content/web/Customers/${CustomerID}.jpg')"></span>
<span>${ContactName}</span>
</ak-template>
</ak-multiselect>
</div>
</div>
</template>
export class Grouping {
dataSource = {
transport: {
read: {
dataType: 'jsonp',
url: '//demos.telerik.com/kendo-ui/service/Customers'
}
}
}
}
.dropdown-header {
border-width: 0 0 1px 0;
text-transform: uppercase;
}
.dropdown-header > span {
display: inline-block;
padding: 10px;
}
.dropdown-header > span:first-child {
width: 50px;
}
.selected-value {
display: inline-block;
vertical-align: middle;
width: 18px;
height: 18px;
background-size: 100%;
margin-right: 5px;
border-radius: 50%;
}
.k-item {
line-height: 1em;
min-width: 300px;
}
/* Material Theme padding adjustment*/
.k-material .k-item,
.k-material .k-item.k-state-hover,
.k-materialblack .k-item,
.k-materialblack .k-item.k-state-hover {
padding-left: 5px;
border-left: 0;
}
.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;
}
.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;
}
h3 {
font-size: 1.2em;
font-weight: normal;
margin: 0 0 1px 0;
padding: 0;
}
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