editor & dataSource

by aidankirrane

HTML

<script src="http://cdn.kendostatic.com/2012.2.710/js/kendo.all.min.js"></script>
<link rel="stylesheet" href="http://cdn.kendostatic.com/2012.2.710/styles/kendo.common.min.css">
<link rel="stylesheet" href="http://cdn.kendostatic.com/2012.2.710/styles/kendo.default.min.css">
<link rel="stylesheet" href="http://cdn.kendostatic.com/2012.2.710/styles/kendo.mobile.all.min.css">
<div id="example">
    <input type="text" id="speccontact"  />
    <input type="text" id="rego"  />
    <br />
    <br />
    <input type="text" id="osaid"  />
    <input type="text" id="radioid"  />
    <br />
    <br />
   
</div>

<script id="row-template" type="text/x-kendo-template">
    <tr>
        <td data-bind="text: id">
        </td>
        <td data-bind="text: description">
        </td>
        <td data-bind="text: rank"></td>
    </tr>
</script>

JavaScript

var viewModel = kendo.observable({
    person: {
        Firstname: "Jim",
        Lastname: "Smith",
        Birthday: "08/29/1979",
        Likes: [ 
            { id: 1, description: "Baseball", rank: 1 }, 
            {id: 2, description: "music", rank: 3 }, 
            { id: 3, description: "Surfing the web", rank: 2}
        ]
    }       
});

var respObj = ({
    "Data": {
        "EmployeeList": [
            {
                "CallingEmployee": "TRUE",
                "DigitalRadioId": null,
                "EmployeeId": 10018,
                "OsaDeviceId": "1234"
            },
            {
                "CallingEmployee": "FALSE",
                "DigitalRadioId": "456",
                "EmployeeId": 101904808,
                "OsaDeviceId": null
            }
        ],
        "EquipmentList": [
            "BUSHMASTER",
            "TDD"
        ],
        "ShiftDuration": 28800,
        "ShiftEnd": "11-Sep-2018 16:00",
        "ShiftStart": "11-Sep-2018 08:00",
        "SpecialContact": "123456",
        "VehicleId": "PL6317"
    },
    "Message": "Process completed successfully",
    "ResultCode": 0
});

var elm_txtSpecialContact = document.getElementById('speccontact');
var elm_txtVehicleRego = document.getElementById('rego');
elm_txtSpecialContact.value = respObj.Data.SpecialContact;
elm_txtVehicleRego.value = respObj.Data.VehicleId;

var elm_txtOSAID= document.getElementById('osaid');
var elm_txtRadioID = document.getElementById('radioid');
elm_txtOSAID.value = respObj.Data.EmployeeList[1].OsaDeviceId;
elm_txtRadioID.value = respObj.Data.EmployeeList[1].DigitalRadioId;