Skip to content

Commit 0c7c8bd

Browse files
committed
Improve RequireJS demo
1 parent 6ec6853 commit 0c7c8bd

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

using-kendo-with-requirejs.md

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,39 @@ position: 210
77

88
The production (minified) builds of Kendo UI are designed to work with [RequireJS](http://requirejs.org/). Therefore if you need to use only a few components instead of loading the full `kendo.all.js`, you may now declare only the components you need and RequireJS will take care to load any needed dependencies.
99

10-
For example, supposing you need to use a grid and a menu, your code could look like this (replace *VERSION* with the Kendo UI version that you want to use):
10+
For example, supposing you need to use a grid and a dropdownlist, your code could look like this:
11+
12+
<div id="grid"></div>
13+
<br>
14+
<select id="ddl"></select>
15+
16+
<!-- Load the jQuery and RequireJS files from CDN -->
17+
18+
<script data-main="http://cdn.kendostatic.com/2014.2.903/js/jquery.min.js"
19+
src="http://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.1/require.min.js"></script>
1120

12-
<script data-main="http://cdn.kendostatic.com/VERSION/js/jquery.min.js"
13-
src="http://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.1/require.min.js"></script>
1421
<script>
15-
require([ "kendo.menu.min", "kendo.grid.min" ], initApp);
22+
require([ "kendo.dropdownlist.min", "kendo.grid.min" ], initApp); //include the needed Kendo UI widgets scripts
23+
1624
function initApp() {
17-
// here it's safe to use kendo.menu and kendo.grid widgets
25+
//you can initialzie the Kendo UI components here
26+
$('#grid').kendoGrid({
27+
dataSource:{
28+
data: [{name: "John Doe"}]
29+
}
30+
})
31+
32+
$('#ddl').kendoDropDownList({
33+
dataSource: {
34+
data: [{name:"Jane Doe", value: 1}, {name:"John Doe", value: 2}]
35+
},
36+
dataTextField: "name",
37+
dataValueField: "value"
38+
})
1839
}
1940
</script>
2041

21-
and you don't need to worry about which other files are necessary for the grid and menu widgets.
42+
and you don't need to worry about which other files are necessary for the grid and dropdownlist widgets.
2243

2344
## Configuring RequireJS
2445

0 commit comments

Comments
 (0)