Skip to content

Commit d5ecaf5

Browse files
author
Kendo Bot
committed
Sync with Kendo UI Professional
1 parent 8e3ac8a commit d5ecaf5

File tree

16 files changed

+739
-79
lines changed

16 files changed

+739
-79
lines changed
Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
---
2+
title: PivotGrid Drill Down Window
3+
description: How to Implement Drill Down Navigation
4+
type: how-to
5+
page_title: How to Implement Drill Down Functionality | Kendo UI PivotGrid for jQuery
6+
slug: pivotgrid-drill-down-window
7+
position:
8+
tags:
9+
ticketid:
10+
res_type: kb
11+
---
12+
13+
## Environment
14+
<table>
15+
<tbody>
16+
<tr>
17+
<td>Product</td>
18+
<td>PivotGrid for Progress® Kendo UI®</td>
19+
</tr>
20+
</tbody>
21+
</table>
22+
23+
24+
## Description
25+
26+
This sample demonstrates how to implement a Drill Down Window for the PivotGrid, which will display additional details for a given cell.
27+
28+
## Solution
29+
30+
The key part is creating a secondary **drillDownDataSource**, which will request and hold only a subset of the data related to the clicked cell. This is achieved using multiple [filters](https://docs.telerik.com/kendo-ui/api/javascript/data/datasource/configuration/filter#filterfilters).
31+
32+
```dojo
33+
<style>
34+
#pivotgrid {
35+
display: inline-block;
36+
vertical-align: top;
37+
}
38+
.k-fieldselector{
39+
display: none !important;
40+
}
41+
.dataCell,
42+
.totalCell{
43+
text-decoration: underline !important;
44+
color: initial !important;
45+
}
46+
</style>
47+
48+
<script src="https://demos.telerik.com/kendo-ui/content/shared/js/products.js"></script>
49+
50+
<div class='drill-down-container'></div>
51+
52+
<div id="example">
53+
<div class="hidden-on-narrow" id="configurator"></div>
54+
<div class="hidden-on-narrow" id="pivotgrid"></div>
55+
56+
<div class="responsive-message"></div>
57+
58+
<script>
59+
$(document).ready(function () {
60+
var pivotgrid = $("#pivotgrid").kendoPivotGrid({
61+
filterable: true,
62+
sortable: true,
63+
columnWidth: 120,
64+
height: 350,
65+
dataCellTemplate: $("#dataCellTemplate").html(),
66+
dataSource: {
67+
data: products,
68+
schema: {
69+
model: {
70+
fields: {
71+
ProductName: { type: "string" },
72+
UnitPrice: { type: "number" },
73+
UnitsInStock: { type: "number" },
74+
Discontinued: { type: "boolean" },
75+
CategoryName: { field: "Category.CategoryName" }
76+
}
77+
},
78+
cube: {
79+
dimensions: {
80+
ProductName: { caption: "All Products" },
81+
CategoryName: { caption: "All Categories" },
82+
Discontinued: { caption: "Discontinued" }
83+
},
84+
measures: {
85+
"Sum": { field: "UnitPrice", format: "{0:c}", aggregate: "sum" },
86+
"Average": { field: "UnitPrice", format: "{0:c}", aggregate: "average" }
87+
}
88+
}
89+
},
90+
columns: [{ name: "CategoryName", expand: true }, { name: "ProductName" } ],
91+
rows: [{ name: "Discontinued", expand: true }],
92+
measures: ["Sum"]
93+
}
94+
}).data("kendoPivotGrid");
95+
});
96+
97+
var dataSource;
98+
99+
function showDrillDown(link, event){
100+
var pivot = $("#pivotgrid").data().kendoPivotGrid;
101+
dataSource = pivot.dataSource;
102+
var cell = link.parentElement;
103+
var cellInfo = pivot.cellInfoByElement(cell);
104+
var rowMembers = cellInfo.rowTuple.members;
105+
var columnMembers = cellInfo.columnTuple.members;
106+
var filterDetails = { logic: "and", filters: [] };
107+
108+
for (var i = rowMembers.length - 1; i >= 0; i--) {
109+
var rowLevelInfo = rowMembers[i];
110+
var fieldName = rowLevelInfo.parentName;
111+
112+
if(fieldName)
113+
{
114+
var value = parseValue(fieldName, rowLevelInfo.caption);
115+
filterDetails.filters.push({ field: fieldName, operator: "eq", value: value });
116+
}
117+
}
118+
119+
for (var i = columnMembers.length - 1; i >= 0; i--) {
120+
var columnLevelInfo = columnMembers[i];
121+
var fieldName = columnLevelInfo.parentName;
122+
123+
if(fieldName)
124+
{
125+
var value = parseValue(fieldName, columnLevelInfo.name.replace(fieldName + "&",""));
126+
127+
filterDetails.filters.push({ field: fieldName, operator: "eq", value: value });
128+
}
129+
}
130+
131+
var drillDownDataSource = new kendo.data.DataSource({
132+
data: dataSource._pristineData,
133+
schema: dataSource.schema,
134+
filter: filterDetails
135+
});
136+
137+
showWindow(drillDownDataSource);
138+
}
139+
140+
function showWindow(drillDownDataSource){
141+
var container = $(".drill-down-container");
142+
container.append("<div class='drill-down-window'><div id='grid'></div></div>");
143+
144+
var window = container.find(".drill-down-window").kendoWindow({
145+
width: "600px",
146+
title: "Drill Down Details",
147+
close: onClose,
148+
scrollable: true,
149+
open: function (e) {
150+
$("html, body").css("overflow", "hidden");
151+
},
152+
modal: {
153+
preventScroll: true
154+
},
155+
}).data().kendoWindow;
156+
157+
var gridColumns = [];
158+
var fields = dataSource.options.schema.model.fields;
159+
160+
for (var fieldName in fields) {
161+
gridColumns.push({field: fieldName, type: fields[fieldName]});
162+
}
163+
164+
var grid = window.element.find("#grid").kendoGrid({
165+
dataSource: drillDownDataSource,
166+
columns: gridColumns,
167+
scrollable: true,
168+
height: 200
169+
}).data().kendoGrid;
170+
171+
window.center();
172+
}
173+
function onClose(e){
174+
setTimeout(function(){
175+
e.sender.destroy();
176+
$(".drill-down-container").empty();
177+
}, 250);
178+
}
179+
function parseValue(fieldName, value){
180+
var type = dataSource.options.schema.model.fields[fieldName].type;
181+
182+
if(value && value != '')
183+
{
184+
if(type == "number") {
185+
return parseFloat(value);
186+
}
187+
else if(type == "boolean")
188+
{
189+
return (value == 'true');
190+
}
191+
else if(type == "string"){
192+
var parsedDate = kendo.parseDate(value);
193+
if (parsedDate) {
194+
return parsedDate;
195+
}
196+
}
197+
}
198+
return value;
199+
}
200+
201+
</script>
202+
<script id="dataCellTemplate" type="text/x-kendo-tmpl">
203+
# var columnMember = columnTuple ? columnTuple.members[0] : { children: [] }; #
204+
# var rowMember = rowTuple ? rowTuple.members[0] : { children: [] }; #
205+
# var value = kendo.toString(kendo.parseFloat(dataItem.value) || "N/A", "c2"); #
206+
207+
# if (rowMember.children.length) { #
208+
<a class='dataCell' href="javascript:void(0);" onclick='showDrillDown(this);'>#: value # (total)</em>
209+
# } else if(columnMember.children.length){ #
210+
<a class='dataCell' href="javascript:void(0);" onclick='showDrillDown(this);'>#: value # (total)</em>
211+
# } else { #
212+
<a class='totalCell' href="javascript:void(0);" onclick='showDrillDown(this); return false;'>#: value #</em>
213+
# } #
214+
</script>
215+
</div>
216+
```

src/kendo.binder.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,6 +1626,24 @@ var __meta__ = { // jshint ignore:line
16261626
}
16271627
}
16281628
})
1629+
},
1630+
1631+
badge: {
1632+
text: Binder.extend({
1633+
init: function(widget, bindings, options) {
1634+
Binder.fn.init.call(this, widget.element[0], bindings, options);
1635+
1636+
this.widget = widget;
1637+
},
1638+
refresh: function() {
1639+
var text = this.bindings.text.get();
1640+
1641+
if (text == null) {
1642+
text = "";
1643+
}
1644+
this.widget.text(text);
1645+
}
1646+
})
16291647
}
16301648
};
16311649

src/kendo.multiselect.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,6 +1304,8 @@ var __meta__ = { // jshint ignore:line
13041304

13051305
that._setOption(getter(addedItem.dataItem), true);
13061306
}
1307+
1308+
that._updateTagListAria();
13071309
} else {
13081310
if (!that._maxTotal || that._maxTotal < total) {
13091311
that._maxTotal = total;
@@ -1340,6 +1342,15 @@ var __meta__ = { // jshint ignore:line
13401342
currentTotal: total
13411343
}));
13421344
}
1345+
1346+
that._updateTagListAria();
1347+
},
1348+
1349+
_updateTagListAria: function () {
1350+
var that = this;
1351+
var tagList = that.tagList;
1352+
1353+
tagList.attr("role", tagList.children().length ? "listbox" : "presentation");
13431354
},
13441355

13451356
_select: function(candidate) {
@@ -1450,10 +1461,10 @@ var __meta__ = { // jshint ignore:line
14501461
that._focused = that.input = input.attr({
14511462
"accesskey": accessKey,
14521463
"autocomplete": AUTOCOMPLETEVALUE,
1453-
"role": "listbox",
1464+
"role": "textbox",
14541465
"title": element[0].title,
14551466
"aria-expanded": false,
1456-
"aria-haspopup": "listbox",
1467+
"aria-haspopup": "true",
14571468
"aria-autocomplete": "list"
14581469
});
14591470
},
@@ -1532,7 +1543,7 @@ var __meta__ = { // jshint ignore:line
15321543
wrapper[0].style.cssText = element[0].style.cssText;
15331544
wrapper[0].title = element[0].title;
15341545

1535-
$('<div class="k-multiselect-wrap k-floatwrap" role="listbox" unselectable="on" />').insertBefore(element);
1546+
$('<div class="k-multiselect-wrap k-floatwrap" unselectable="on" />').insertBefore(element);
15361547
}
15371548

15381549
that.wrapper = wrapper.addClass(element[0].className).removeClass('input-validation-error').css("display", "");

src/messages/kendo.messages.bg-BG.js

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,4 +1224,72 @@ if (kendo.ui.Wizard) {
12241224
});
12251225
}
12261226

1227+
1228+
/* PDFViewer messages */
1229+
1230+
if (kendo.ui.PDFViewer) {
1231+
kendo.ui.PDFViewer.prototype.options.messages =
1232+
$.extend(true, kendo.ui.PDFViewer.prototype.options.messages, {
1233+
defaultFileName: "Документ",
1234+
toolbar: {
1235+
zoom: {
1236+
zoomLevel: "ниво на приближение",
1237+
zoomOut: "Отдалечи",
1238+
zoomIn: "Приближи",
1239+
actualWidth: "Действителна ширина",
1240+
autoWidth: "Автоматична ширина",
1241+
fitToWidth: "Изпълни ширината",
1242+
fitToPage: "Покажи цяла страница"
1243+
},
1244+
open: "Отвори",
1245+
exportAs: "Експортирай",
1246+
download: "Свали",
1247+
pager: {
1248+
first: "Отиди на първата страница",
1249+
previous: "Отиди на предишната страница",
1250+
next: "Отиди на следващата страница",
1251+
last: "Отиди на последната страница",
1252+
of: " от {0} ",
1253+
page: "страница",
1254+
pages: "страници"
1255+
},
1256+
print: "Разпечатай",
1257+
toggleSelection: "Активирай селектиране",
1258+
togglePan: "Активирай местене",
1259+
search: "Търси"
1260+
},
1261+
errorMessages: {
1262+
notSupported: "Разрешени са само файлове в PDF.",
1263+
parseError: "Неуспешно обработване на PDF файлът.",
1264+
notFound: "Файлът не беше открит.",
1265+
popupBlocked: "Изскачащият прозорец беше блокиран."
1266+
},
1267+
dialogs: {
1268+
exportAsDialog: {
1269+
title: "Експортирай...",
1270+
defaultFileName: "Документ",
1271+
pdf: "Portable Document Format (.pdf)",
1272+
png: "Portable Network Graphics (.png)",
1273+
svg: "Scalable Vector Graphics (.svg)",
1274+
labels: {
1275+
fileName: "Име на файла",
1276+
saveAsType: "Сапази като",
1277+
page: "Страница"
1278+
}
1279+
},
1280+
okText: "ОК",
1281+
save: "Сапази",
1282+
cancel: "Отмени",
1283+
search: {
1284+
inputLabel: "Търси текст",
1285+
matchCase: "Търси според малки/големи букви",
1286+
next: "Следващо съвпадение",
1287+
previous: "Предишно съвпадение",
1288+
close: "Затвори",
1289+
of: "от"
1290+
}
1291+
}
1292+
});
1293+
}
1294+
12271295
})(window.kendo.jQuery);

0 commit comments

Comments
 (0)