【问题标题】:Kendo Grid Hierarchy View - How to fill with existing and related dataSource?Kendo Grid Hierarchy View - 如何填充现有和相关的数据源?
【发布时间】:2014-11-26 11:14:17
【问题描述】:

我想使用包含读取请求数据的层次网格。

http://demos.telerik.com/kendo-ui/grid/hierarchy

问题是函数 detailInit 正在处理第二个请求,但我想从现有数据源获取和更新数据。

问题是:

请问如何显示和更新(在数据集上)现有数据源中选定行的相关数据?

点击行展开箭头初始化的函数:

function detailInit(e) {
      alert("TEST");
      $("<div/>").appendTo(e.detailCell).kendoGrid({
        dataSource: {
          type: "odata",
          transport: {
            read: "http://demos.telerik.com/kendo-ui/service/Northwind.svc/Orders"
          },
          serverPaging: true,
          serverSorting: true,
          serverFiltering: true,
          pageSize: 10,
          filter: { field: "EmployeeID", operator: "eq", value: e.data.EmployeeID }
        },
        scrollable: false,
        sortable: true,
        pageable: true,
        columns: [
          { field: "OrderID", width: "70px" },
          { field: "ShipCountry", title:"Ship Country", width: "110px" },
          { field: "ShipAddress", title:"Ship Address" },
          { field: "ShipName", title: "Ship Name", width: "300px" }
        ]
      });
    };

非常感谢您的帮助。

【问题讨论】:

  • 这个问题有什么解决办法吗?

标签: jquery kendo-ui telerik kendo-grid


【解决方案1】:

为什么不尝试从之前创建的主数据源中获取数据源。你可以写

function detailInit(e) {
      alert("TEST");
      $("<div/>").appendTo(e.detailCell).kendoGrid({
         // you should gather masterDataSource here or get from function parameter
         dataSource: {
             data: masterDataSourceName,
             pageSize: 10,
             schema: {
                 model: {
                     fields: {
                        field: "EmployeeID"
                     }
                 }
             }
        },
        scrollable: false,
        sortable: true,
        pageable: true,
        columns: [
          { field: "OrderID", width: "70px" },
          { field: "ShipCountry", title:"Ship Country", width: "110px" },
          { field: "ShipAddress", title:"Ship Address" },
          { field: "ShipName", title: "Ship Name", width: "300px" }
        ]
      });
    };

像这样。如果您没有任何 masterDataSource,您应该从您的数据库中收集它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-08-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-25
    相关资源
    最近更新 更多