grid json bind

by valchev

HTML

<script src="http://cdn.kendostatic.com/2012.1.322/js/kendo.all.min.js"></script>
<link rel="stylesheet" href="http://cdn.kendostatic.com/2012.1.322/styles/kendo.common.min.css">
<link rel="stylesheet" href="http://cdn.kendostatic.com/2012.1.322/styles/kendo.metro.min.css">
<div id="grid"></div>

JavaScript

var ds = new kendo.data.DataSource({
    transport: {
        read: {
            //using jsfiddle echo service to simulate JSON endpoint
            url: "/echo/json/",
            dataType: "json",
            type: "POST",
            data: {
                // /echo/json/ echoes the JSON which you pass as an argument
                json: JSON.stringify(
                    [
                        {"date":"\/Date(1234656000000)\/"},
                        {"date":"/Date(1245398693390)/"}
                    ]
                )
            }
        }
    },
    schema: {
        model: {
            fields: {
                date: { type: "date" }
            }
        }           
    }
});
   
$("#grid").kendoGrid({
    dataSource: ds,
    height: 180,
    columns: [
        { field:"date", title: "Date" }
    ]
});

function customParser(data) {
    return new Date(data);
}