【问题标题】:Is there a way to declare a databound function for kendo grid inside an another grid?有没有办法在另一个网格中为剑道网格声明数据绑定函数?
【发布时间】:2022-10-17 15:09:44
【问题描述】:

我想在另一个网格内调整我的网格的大小。这些网格是分层的。我为此写了一些东西,但这适用于第二次点击。我提到的过程可以在图片中看到(firstclick,secondclick)。红色圆圈显示扩展按钮。

我为解决方案编写的 js 代码块但无法正常工作:

// The code inside the databound function of master grid
    $("#SiparisListeleGrid td a.k-icon").click(function () { // onclick for a element that opens second grid inside the row
        if ($(this).hasClass("k-i-expand")) { // if the grid is expand

            // uid of tr element
            var tr_UID = $(this).parents("tr").data("uid");

            // master grid
            var ustGrid = $("#SiparisListeleGrid").data("kendoGrid");

            $(ustGrid.dataSource.data()).each(function (i, item) {
                if (item.uid == tr_UID) {
                    var altGrid = $("#Grid_SiparisSatir_" + item.SipUstID).data("kendoGrid");
                    var rowCount = altGrid.dataSource.view().length;

                    $("#Grid_SiparisSatir_" + item.SipUstID).attr("style", "height:" + (rowCount * 40 + 125) + "px;");

                    $("#Grid_SiparisSatir_" + item.SipUstID + " .k-grid-content").css("height", (rowCount * 40));

                    $("#Grid_SiparisSatir_" + item.SipUstID + " .k-grid-content-locked").css("height", (rowCount * 40));
                }
            });
        }
    });
    // This code block only works on second clicking the expan button.
    // Does not recognize the second grid when clicked for the firs time
    // Should I use databound for second grid? However I do not know how can I do that.

firstclick

secondclick

【问题讨论】:

    标签: kendo-ui kendo-grid kendo-asp.net-mvc


    【解决方案1】:

    这个代码块让我将数据绑定到子网格。它对我有用。 Solution

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-02
      • 1970-01-01
      • 2013-08-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多