Skip to content

Instantly share code, notes, and snippets.

@len-ro
Last active August 14, 2016 18:02
Show Gist options
  • Save len-ro/01a12c5364b52690c703d3c83f44a8e6 to your computer and use it in GitHub Desktop.
Save len-ro/01a12c5364b52690c703d3c83f44a8e6 to your computer and use it in GitHub Desktop.
grid onSearch
{
"list":{
"folder":[
{
"localizedNames":{
"_class":"java.util.ArrayList"
},
"customFields":{
"_class":"java.util.ArrayList"
},
"scope":{
"_name":"Danone",
"__text":"362"
},
"entity":{
"_name":"Compagnie Gervais Danone",
"_shortname":"CGD",
"__text":"1949"
},
"folderType":{
"_name":"Hedging",
"_shortname":"hedging",
"_customDictionaryName":"folderType",
"__text":"1029"
},
"_id":"957",
"_active":"true",
"_shortname":"CGD",
"_name":"CGD",
"_status":"actual",
"_isUpdatable":"true",
"_lastUpdate":"2012-07-12T06:51:21.484Z",
"_lastUpdateUser":"Responsable BO",
"_captureUser":"Responsable BO",
"_captureDate":"2012-07-12T06:51:21.484Z",
"_version":"1",
"_isPreferred":"true",
"_reclassificationYear":"0"
},
{
"localizedNames":{
"_class":"java.util.ArrayList"
},
"previous":{
"_class":"folder",
"__text":"910"
},
"customFields":{
"_class":"java.util.ArrayList"
},
"scope":{
"_name":"Root",
"__text":"1"
},
"entity":{
"_name":"CPCEA 2",
"_shortname":"CPCEA2",
"__text":"977"
},
"folderType":{
"_name":"Hedging",
"_shortname":"hedging",
"_customDictionaryName":"folderType",
"__text":"1029"
},
"_id":"842",
"_active":"true",
"_shortname":"CPCEA",
"_name":"CPCEA",
"_status":"actual",
"_isUpdatable":"true",
"_lastUpdate":"2012-07-10T17:06:28.189Z",
"_lastUpdateUser":"Passe-Partout",
"_captureUser":"Passe-Partout",
"_captureDate":"2012-07-10T17:06:28.189Z",
"_version":"2",
"_isPreferred":"true",
"_reclassificationYear":"0"
},
{
"localizedNames":{
"_class":"java.util.ArrayList"
},
"customFields":{
"_class":"java.util.ArrayList"
},
"scope":{
"_name":"Root",
"__text":"1"
},
"entity":{
"_name":"CPCEA 2",
"_shortname":"CPCEA2",
"__text":"977"
},
"folderType":{
"_name":"Hedging",
"_shortname":"hedging",
"_customDictionaryName":"folderType",
"__text":"1029"
},
"_id":"910",
"_active":"true",
"_shortname":"CPCEA",
"_name":"CPCEA",
"_status":"archive",
"_isUpdatable":"false",
"_lastUpdate":"2012-07-04T15:22:42.393Z",
"_lastUpdateUser":"Passe-Partout",
"_captureUser":"Passe-Partout",
"_captureDate":"2012-07-04T15:22:42.393Z",
"_version":"1",
"_archiveId":"8567",
"_isPreferred":"false",
"_reclassificationYear":"0"
},
{
"localizedNames":{
"_class":"java.util.ArrayList"
},
"customFields":{
"_class":"java.util.ArrayList"
},
"scope":{
"_name":"Root",
"__text":"1"
},
"entity":{
"_name":"Hachette",
"_shortname":"Hachette",
"__text":"222"
},
"positionMethod":{
"_name":"FIFO",
"_shortname":"fifo",
"_customDictionaryName":"positionMethod",
"__text":"878"
},
"folderType":{
"_name":"Hedging",
"_shortname":"hedging",
"_customDictionaryName":"folderType",
"__text":"1029"
},
"_id":"309",
"_active":"true",
"_shortname":"CapGemini",
"_name":"CapGemini",
"_status":"archive",
"_isUpdatable":"false",
"_lastUpdate":"2011-05-12T10:32:15.312Z",
"_lastUpdateUser":"Passe-Partout",
"_captureUser":"Passe-Partout",
"_captureDate":"2011-05-12T10:32:15.312Z",
"_version":"1",
"_archiveId":"5281",
"_isPreferred":"false",
"_reclassificationYear":"0"
},
{
"localizedNames":{
"_class":"java.util.ArrayList"
},
"previous":{
"_class":"folder",
"__text":"309"
},
"customFields":{
"_class":"java.util.ArrayList"
},
"scope":{
"_name":"Root",
"__text":"1"
},
"entity":{
"_name":"Hachette",
"_shortname":"Hachette",
"__text":"222"
},
"positionMethod":{
"_name":"FIFO",
"_shortname":"fifo",
"_customDictionaryName":"positionMethod",
"__text":"878"
},
"folderType":{
"_name":"Hedging",
"_shortname":"hedging",
"_customDictionaryName":"folderType",
"__text":"1029"
},
"_id":"502",
"_active":"true",
"_shortname":"CapGemini",
"_name":"CapGemini",
"_status":"archive",
"_isUpdatable":"false",
"_lastUpdate":"2011-05-12T10:38:32.388Z",
"_lastUpdateUser":"Passe-Partout",
"_captureUser":"Passe-Partout",
"_captureDate":"2011-05-12T10:38:32.388Z",
"_version":"2",
"_archiveId":"6702",
"_isPreferred":"false",
"_reclassificationYear":"0"
},
{
"localizedNames":{
"_class":"java.util.ArrayList"
},
"previous":{
"_class":"folder",
"__text":"422"
},
"customFields":{
"_class":"java.util.ArrayList"
},
"scope":{
"_name":"Root",
"__text":"1"
},
"entity":{
"_name":"Subsidiary A",
"_shortname":"SUB_A",
"__text":"1067"
},
"positionMethod":{
"_name":"FIFO",
"_shortname":"fifo",
"_customDictionaryName":"positionMethod",
"__text":"878"
},
"folderType":{
"_name":"Hedging",
"_shortname":"hedging",
"_customDictionaryName":"folderType",
"__text":"1029"
},
"_id":"442",
"_active":"true",
"_shortname":"Client",
"_name":"Client",
"_status":"archive",
"_isUpdatable":"false",
"_lastUpdate":"2011-09-13T09:12:08.964Z",
"_lastUpdateUser":"Passe-Partout",
"_captureUser":"Passe-Partout",
"_captureDate":"2011-09-13T09:12:08.964Z",
"_version":"3",
"_archiveId":"6263",
"_isPreferred":"false",
"_reclassificationYear":"0"
}
]
}
}
<template>
<button type="button" click.delegate="onSearch(event)">Search</button>
${resultsShortInfo}
<ak-grid ak-grid="k-no-init.bind: true;" ak-grid.ref="searchResultsGridVM" k-data-source.bind="searchResults" k-pageable.bind="false"
k-sortable.bind="true" k-resizable.bind="true" k-editable.bind="true">
<ak-col k-title="Id" k-field="_id"></ak-col>
<ak-col k-title="Name" k-field="_name"></ak-col>
<ak-col k-title="Shortname" k-field="_shortname"></ak-col>
</ak-grid>
</template>
import { HttpClient } from 'aurelia-fetch-client';
export class GridSearch {
searchResults = null;
onSearch(event){
let http = new HttpClient();
return http.fetch('api-folder.json')
.then(response => response.json())
.then(data => {
this.searchResults = new kendo.data.DataSource({
data: data['list']['folder'],
schema: {
model: { id: "_id" }
}
});
this.searchResults.read().then(() => {
console.log("searchResults.fetch.then: " + this.searchResults.total());
this.resultsShortInfo = '#' + this.searchResults.total();
this.searchResultsGridVM.recreate();
});
});
}
}
<!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.2.714/js/jquery.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2016.2.714/js/kendo.all.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.22/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