This is a migrated thread and some comments may be shown as answers.

Alert is not showing thr current row id in ... please help

0 Answers 24 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Divya
Top achievements
Rank 1
Divya asked on 12 Jul 2012, 06:24 AM
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script src="http://localhost/tp-ms/static/js/jquery.min.js"></script>
    <script src="http://localhost/tp-ms/static/controls/kendoui/js/kendo.web.min.js"></script>       
    <link href="http://localhost/tp-ms/static/controls/kendoui/styles/kendo.common.min.css" rel="stylesheet" />
    <link href="http://localhost/tp-ms/static/controls/kendoui/styles/kendo.default.min.css" rel="stylesheet" />
    <link href="http://localhost/tp-ms/static/controls/kendoui/js/kendo.all.min.js" rel="stylesheet" />
     <link rel="stylesheet" href="http://localhost/tp-ms/static/css/grids-min.css" type="text/css">

</head>
<body>
<div id="grid">
</div>
<script>
var dataSample = [];
dataSample.push({
    OrderID: "1",
    ShipName: "line 1"
});
dataSample.push({
    OrderID: "2",
    ShipName: "line 2"
});
dataSample.push({
    OrderID: "3",
    ShipName: "line 3"
});

var dataSource = new kendo.data.DataSource({
    data: dataSample,
    schema: {
        model: {
            id: "OrderID"
        }
    },
    pageSize: 10
});

$("#grid").kendoGrid({
    dataSource: dataSource,
    selectable: true,
    change: function() {
        var row = this.select();
        var id = row.data("id");
        alert(id); // showing undefined but i want the current id...
    },
    columns: ["OrderID", "ShipName"],
        
});

</script>

</body>
</html>

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Divya
Top achievements
Rank 1
Share this question
or