如何在Kendo Grid中添加/插入行?

时间:2012-05-24 06:10:08

标签: jquery

当绑定的dataSource发生更改(插入/删除/添加)时,无论如何都要在Kendo Grid中添加/插入行

1 个答案:

答案 0 :(得分:6)

Working Demo here click here http://jsfiddle.net/VMrqS/

http://jsfiddle.net/D3rSk/7/

我为此演示阅读此链接可以帮助您:希望这对您有用:http://www.kendoui.com/documentation/ui-widgets/grid/walkthrough.aspx

这将显示添加新行或删除示例。

<强>码

                $(document).ready(function() {
                    $("#grid").kendoGrid({
                        dataSource: {
                            type: "odata",
                            transport: {
                                read: "http://demos.kendoui.com/service/Northwind.svc/Orders"
                            },
                            schema: {
                                model: {
                                    fields: {
                                        OrderID: { type: "number" },
                                        Freight: { type: "number" },
                                        ShipName: { type: "string" },
                                        OrderDate: { type: "date" },
                                        ShipCity: { type: "string" }
                                    }
                                }
                            },
                            pageSize: 10,
                            serverPaging: true,
                            serverFiltering: true,
                            serverSorting: true
                        },
                        height: 250,
                        filterable: true,
                        sortable: true,
                        pageable: true,
                        columns: [{
                                field:"OrderID",
                                filterable: false
                            },
                            "Freight", {
                                field: "OrderDate",
                                format: "{0:MM/dd/yyyy}"
                            },
                            "ShipName",
                            "ShipCity",
                            { command: "destroy", title: " ", width: "110px"}
                           ]

                    });
                });
​