【问题标题】:Is there a way to span a column for a single row in a Kendo Grid?有没有办法跨越剑道网格中单行的列?
【发布时间】:2021-12-16 04:29:59
【问题描述】:

我想找到一种方法,在 Kendo Grid for Angular 中只为 1 行数据跨列。我研究过使用kendo-grid-span-column,但这似乎适用于指定列的每一行。我也研究过使用kendoGridFooterTemplate,但似乎还不支持跨越它。我在下面发布了一个示例的图片:

【问题讨论】:

标签: angular kendo-ui kendo-grid kendo-ui-angular2


【解决方案1】:

您应该可以通过在数据绑定事件期间手动添加colspan 属性来完成此操作。

请参阅下面的示例,了解我使用名为 isSpecial 的布尔数据字段来确定是否需要更改该行:

function onDataBound(e) {
  var grid = $("#myGrid").data("kendoGrid");

  // Iterate through all the rows
  var rows = grid.items();
  $(rows).each(function (e) {
     var row = this;
     var data = grid.dataItem(row);

     // Check if this row needs to be altered
     if (data.isSpecial) {
        // Set the column span
        $(row).find("td:first-child").attr("colspan", "5");
     }
  });
}

【讨论】:

    猜你喜欢
    • 2017-05-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-10-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多