grid popup template with autoComplete

by Teac

HTML

<script src="http://cdn.kendostatic.com/2012.2.913/js/kendo.all.min.js"></script>
<link rel="stylesheet" href="http://cdn.kendostatic.com/2012.2.913/styles/kendo.common.min.css">
<link rel="stylesheet" href="http://cdn.kendostatic.com/2012.2.913/styles/kendo.default.min.css">
<!-- grid element -->
<div id="grid" style="width: 700px; margin: 0 auto;"></div>

<!-- popup editor template -->
<script id="popup_editor" type="text/x-kendo-template">
    <div>
    <p>Custom editor template</p>
    <div class="k-edit-label">
        <label for="FirstName">First Name</label>
    </div>
    <input type="text" class="k-input k-textbox" name="firstName" data-bind="value:firstName">       
    
    <div>
    <div data-container-for="positions" >
      <div data-role="grid"
        data-bind="source: positions"
        data-sortable="true"
        data-editable="true"
        data-toolbar='["create"]' 
        data-columns='[
          { command: ["destroy"], title: "&nbsp;", width: "80px" },
          {field: "address", title: "address", template: "#=address.street#" width: "140px"}
        ]'>
      </div>
    </div>
</div>
</div>
</br>
</script>

JavaScript

var data = [{
    id: 1,
    firstName: "Alex",
    positions: [{
        address: {
            street: "somewhere"
        }
    }]
}];

$(document).ready(function() {
    $("#grid").kendoGrid({
        dataSource: {
            data: data,
            schema: {
                model: {
                    id: "id",
                    fields: {
                        firstName: { type: "string" }
                    }
                }
            },
            pageSize: 10
        },
        height: 450,
        scrollable: true,
        sortable: true,
        pageable: true,
        editable: {
            mode: "popup",
            template: kendo.template($("#popup_editor").html())
        },
        toolbar: ["create"],
        columns: [
            {
                field: "firstName",
                title: "First Name",
                width: 100
            },
            {
                command: ["edit", "destroy"],
                title: "&nbsp;",
                width: "200px"
            }
        ]
    });
});