Last active
July 19, 2016 18:49
-
-
Save adriatic/c7710b27c864c9154e25c1218f6c8314 to your computer and use it in GitHub Desktop.
TreeView: binding to local data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<require from="./binding-to-local-data.css"></require> | |
<div id="example"> | |
<div class="demo-section k-content"> | |
<h4>Inline data (default settings)</h4> | |
<div ak-treeview="k-data-source.bind:defaultData" id="treeview-left"></div> | |
</div> | |
<div class="demo-section k-content"> | |
<h4>Inline data</h4> | |
<div ak-treeview="k-data-source.bind:inlineData; k-data-text-field.bind: [ 'categoryName', 'subCategoryName']" id="treeview-right"></div> | |
</div> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class BindingToLocalData { | |
constructor() { | |
this.defaultData = [ | |
{ text: 'Furniture', items: [ | |
{ text: 'Tables & Chairs' }, | |
{ text: 'Sofas' }, | |
{ text: 'Occasional Furniture' } | |
] }, | |
{ text: 'Decor', items: [ | |
{ text: 'Bed Linen' }, | |
{ text: 'Curtains & Blinds' }, | |
{ text: 'Carpets' } | |
] } | |
]; | |
this.inlineData = { | |
data: [ | |
{ categoryName: 'Storage', subCategories: [ | |
{ subCategoryName: 'Wall Shelving' }, | |
{ subCategoryName: 'Floor Shelving' }, | |
{ subCategoryName: 'Kids Storage' } | |
] }, | |
{ categoryName: 'Lights', subCategories: [ | |
{ subCategoryName: 'Ceiling' }, | |
{ subCategoryName: 'Table' }, | |
{ subCategoryName: 'Floor' } | |
] } | |
], | |
schema: { | |
model: { | |
children: 'subCategories' | |
} | |
} | |
}; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#example { | |
text-align: center; | |
} | |
.demo-section { | |
display: inline-block; | |
vertical-align: top; | |
text-align: left; | |
margin: 0 2em; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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