init

Instantiates Kendo UI widgets in a given DOM element based on role data attributes.

Important: Kendo UI Mobile is not included in the default list of initialized namespaces. You can initialize it explicitly by running kendo.init(element, kendo.mobile.ui);

Example

 <div id="view">
    <div>
        <input data-role="autocomplete" data-source="data" data-filter="startswith" data-placeholder="select country ..." />
    </div>
 </div>
 <script>
 var data = [ "Albania", "Andorra", "Armenia", "Austria", "Azerbaijan", "Belarus", "Belgium", "Bosnia & Herzegovina", "Bulgaria", "Croatia", "Cyprus"  ];

 kendo.init($("#view"));
 </script>

Parameters

element String|jQuery|Element

The root element(s) from which the instantiation starts. Can be a valid jQuery string selector, a DOM element or a jQuery object. All descendant elements are traversed.

namespace Object (optional)

Optional namespace too look in when instantiating Kendo UI widgets. The valid namespaces are kendo.ui, kendo.dataviz.ui and kendo.mobile.ui. If omitted kendo.ui will be used. Multiple namespaces can be passed.

Example

 <div id="view">
    <div>
        <input data-role="autocomplete" data-source="data" data-filter="startswith" data-placeholder="select country ..." />
        <button data-role="button" data-click="foo">Foo</button>
    </div>
 </div>

 <script>
 function foo(e) {
     console.log(e.sender); // a mobile button
 }
 var data = [ "Albania", "Andorra", "Armenia", "Austria", "Azerbaijan", "Belarus", "Belgium", "Bosnia & Herzegovina", "Bulgaria", "Croatia", "Cyprus"  ];

 kendo.init($("#view"), kendo.mobile.ui, kendo.ui);
 </script>
In this article
Not finding the help you need? Improve this article