Skip to content

Instantly share code, notes, and snippets.

@johntom
Last active October 7, 2016 13:51
Show Gist options
  • Save johntom/a7481b88a4fd07665ab8f065fce91a45 to your computer and use it in GitHub Desktop.
Save johntom/a7481b88a4fd07665ab8f065fce91a45 to your computer and use it in GitHub Desktop.
Kendo templating Aurelia Grouping Export
<template>
<style>
html {
font-size: 14px;
font-family: Arial, Helvetica, sans-serif;
}
,
.k-grid .ra,
.k-numerictextbox .k-input {
text-align: right;
}
</style>
<div id="example">
<h4>Kendo templating for Aurelia </h4>
<div class='row'>
<div class="col-sm-12">
<div class="col-sm-4">
<!--<input ak-datepicker="k-value.bind : '1/1/2016';k-widget.two-way: startDatePicker" k-on-change.delegate="startChange()" id="start" style="width: 100%;"-->
<span style="margin-top: 2em;"> Supplier :</span>
<input id="supplier" style="width: 25%" />
</div>
<div class="col-sm-4">
<button type="button" class="btn btn-default btn-lg" click.delegate="changeData()">
Search
</button>
</div>
</div>
</div>
<div ref="grid"></div>
</div>
</template>
import $ from 'jquery';
export class Grid {
pageable = {
refresh: true,
pageSizes: true,
buttonCount: 10
};
changeData(){
alert('cd')
}
attached() {
jQuery(this.grid).kendoGrid({
dataSource: {
type: 'odata',
transport: {
read: '//demos.telerik.com/kendo-ui/service/Northwind.svc/Products'
},
group: {
field: "UnitsInStock",
aggregates: [
{ field: "ProductName", aggregate: "count" },
{ field: "UnitPrice", aggregate: "sum" },
{ field: "UnitsOnOrder", aggregate: "average" },
{ field: "UnitsInStock", aggregate: "count" }
]
},
schema: {
model: {
fields: {
ProductName: { type: "string" },
UnitPrice: { type: "number" },
UnitsOnOrder: { type: "number" },
UnitsInStock: { type: "number" },
SupplierID: { type: "number" },
CategoryID: { type: "number" },
}
}
},
pageSize: 20,
groupable: true,
sortable: true,
scrollable: false,
pageable: true,
}
});
}
};
.customer-photo {
display: inline-block;
width: 32px;
height: 32px;
border-radius: 50%;
background-size: 32px 35px;
background-position: center center;
vertical-align: middle;
line-height: 32px;
box-shadow: inset 0 0 1px #999, inset 0 0 10px rgba(0,0,0,.2);
margin-left: 5px;
}
.customer-name {
display: inline-block;
vertical-align: middle;
line-height: 32px;
padding-left: 3px;
}
<!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>
<script src="https://kendo.cdn.telerik.com/2016.1.226/js/jquery.min.js"></script>
<!--<base href="http://demos.telerik.com/kendo-ui/grid/excel-export">-->
</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