This repository has been archived by the owner on Oct 26, 2022. It is now read-only.
forked from ShellRechargeSolutionsEU/kendo-elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 4
/
groups.html
134 lines (121 loc) · 3.81 KB
/
groups.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>Kendo Elasticsearch - demos - Groups</title>
<!--<link rel='stylesheet' href='http://kendo.cdn.telerik.com/2014.1.318/styles/kendo.common.min.css'>-->
<link rel='stylesheet' href='../bower_components/kendo-ui/styles/kendo.common.min.css'>
<!--<link rel='stylesheet' href='http://kendo.cdn.telerik.com/2014.1.318/styles/kendo.default.min.css'>-->
<link rel='stylesheet' href='../bower_components/kendo-ui/styles/kendo.default.min.css'>
</head>
<body>
<h1>Kendo Elasticsearch - demos - Groups</h1>
<div id='grid'></div>
<!--<script src='https://code.jquery.com/jquery-2.1.4.min.js'></script>-->
<script src='../bower_components/jquery/jquery.min.js'></script>
<!--<script src='http://kendo.cdn.telerik.com/2014.1.318/js/kendo.web.min.js'></script>-->
<script src='../bower_components/kendo-ui/src/js/kendo.web.js'></script>
<!--<script src='https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js'></script>-->
<script src='../bower_components/moment/min/moment.min.js'></script>
<script src='../dist/kendo-elasticsearch.js'></script>
<script>
$(document).ready(function() {
$('#grid').kendoGrid({
// configure the datasource to be an ElasticSearchDataSource
dataSource: new kendo.data.ElasticSearchDataSource({
transport: {
read: {
url: 'http://localhost:9200/kendo-elasticsearch-demo/person/_search/'
}
},
pageSize: 10,
schema: {
model: {
esStringSubFields: {
filter: 'lowercase',
agg: 'raw'
},
fields: {
birthCountry: {
type: 'string'
},
birthCity: {
type: 'string'
},
firstName: {
type: 'string',
esName: 'name.firstName'
},
lastName: {
type: 'string',
esName: 'name.lastName'
},
birthDate: {
type: 'date'
},
siblings: {
type: 'number'
}
}
}
},
group: [{
field: "birthCountry",
dir: "asc",
aggregates: [{
field: 'siblings',
aggregate: 'max'
}]
}, {
field: "birthCity",
dir: "asc",
aggregates: [{
field: 'siblings',
aggregate: 'max'
}]
}]
}),
// other grid options besides the datasource
sortable: true,
pageable: true,
filterable: {
extra: true,
operators: {
string: {
search: "Search",
eq: "Is equal to",
neq: "Is not equal to",
startswith: "Starts with",
contains: "Contains",
doesnotcontain: "Does not contain",
endswith: "Ends with"
}
}
},
columns: [{
field: 'birthCountry',
groupHeaderTemplate: "Birth country: #=value#, Count: #=count#",
title: "Birth country"
}, {
field: 'birthCity',
groupHeaderTemplate: "Birth city: #=value#, Count: #=count#",
title: "Birth city"
}, {
field: 'birthDate',
format: '{0:D}',
title: 'Date of birth'
}, {
field: 'firstName',
title: 'First name'
}, {
field: 'lastName',
title: 'Last name'
}, {
field: 'siblings',
groupFooterTemplate: "Max: #=max#"
}]
});
});
</script>
</body>
</html>