0

在详细网格中编辑后,详细网格将展开。我希望它继续扩大。谢谢你。以下是我的网格代码:

$("#grid").kendoGrid({
    editable:true,
    columns: [
      { field: "name" },
      { field: "address" }
    ],
    dataSource: [
      {
          name: "Beverages",
          address: "street 1",
          products: [
            { name: "Tea", price: 20 },
            { name: "Coffee", price: 23 }
          ]
      },
      {
          name: "Food",
          address: "street 2",
          products: [
            { name: "Ham", price: 32 },
            { name: "Bread", price:34 }
          ]
      }
    ],
    detailInit: function (e) {
        $("<div/>").appendTo(e.detailCell).kendoGrid({
            dataSource: e.data.products,
            editable:true,
        });
    }
});
4

1 回答 1

0

网格将折叠(未展开),因为它会在更新数据项时重新绑定自身。您将不得不阻止数据绑定。

detailInit: function (e) {
    var grid = this;
    $("<div/>").appendTo(e.detailCell).kendoGrid({
        dataSource: e.data.products,
        editable:true,
        save: function() {
          // Prevent the next data-binding
          grid.one("dataBinding", function(e) {
            e.preventDefault();
          });
        }
    });
}

这是一个完整的示例:http ://dojo.telerik.com/uWuyI

于 2016-02-23T14:06:05.200 回答