Skip to content

Commit 5795544

Browse files
committed
Add Excel export RequireJS and GlobalizeJS specifics
1 parent 55860ef commit 5795544

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

framework/excel/introduction.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,67 @@ JSZip is part of the Kendo UI distribution and is also available via the Kendo U
2727

2828
> If JSZip is not included in the page Kendo UI will raise a runtime exception.
2929
30+
## Using GlobalizeJS
31+
32+
When GlobalizeJS is needed, it should be included after the Kendo UI scripts.
33+
34+
## Using RequireJS
35+
36+
JSZip doesn't play well with RequireJS by default. However it is possible to make it work. Here is an example:
37+
38+
```html
39+
<script src='https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.16/require.js'></script>
40+
<script>
41+
requirejs.config({
42+
paths : {
43+
jquery : 'http://cdn.kendostatic.com/2014.3.1411/js/jquery.min',
44+
jszip : 'http://cdnjs.cloudflare.com/ajax/libs/jszip/2.4.0/jszip',
45+
kendo : 'http://cdn.kendostatic.com/2014.3.1411/js/kendo.all.min'
46+
},
47+
shim : {
48+
"kendo" : {
49+
deps : [ "jquery", "jszip" ]
50+
}
51+
}
52+
});
53+
</script>
54+
<div id="example">
55+
<div id="grid" style="width: 900px"></div>
56+
<script>
57+
require([ "jszip", "kendo" ], initApp);
58+
function initApp(jszip){
59+
window.JSZip = jszip;
60+
$("#grid").kendoGrid({
61+
toolbar: ["excel"],
62+
excel: {
63+
fileName: "Kendo UI Grid Export.xlsx",
64+
proxyURL: "http://demos.telerik.com/kendo-ui/service/export"
65+
},
66+
dataSource: {
67+
type: "odata",
68+
transport: {
69+
read: "http://demos.telerik.com/kendo-ui/service/Northwind.svc/Products"
70+
},
71+
schema:{
72+
model: {
73+
fields: {
74+
ProductName: { type: "string" },
75+
UnitPrice: { type: "number" }
76+
}
77+
}
78+
},
79+
pageSize: 7,
80+
},
81+
columns: [
82+
{ width: 300, field: "ProductName", title: "Product Name"},
83+
{ width: 300, field: "UnitPrice", title: "Unit Price"}
84+
]
85+
});
86+
}
87+
</script>
88+
</div>
89+
```
90+
3091
## Browser support
3192

3293
Excel generation is available for all [supported browsers](/browsers-support). Saving the file needs a server-side proxy for older browser versions.

0 commit comments

Comments
 (0)