2017-10-22 201 views

回答

0

我想這是你正在尋找的答案。

function resizeDetailGrid(gridElement) { 
    // resize detail column widths to match master column headings 
    gridElement.find('.k-detail-cell tbody tr td').each(function (index) { 
     var headerCell, detailCell, headerCellSelector, detailCellSelector; 
     headerCellSelector = kendo.format('.k-master-row td:nth-child({0})', index + 2); 
     detailCellSelector = kendo.format('.k-detail-cell tbody tr td:nth-child({0})', index + 1); 
     headerCell = gridElement.find(headerCellSelector).first(); 
     detailCell = gridElement.find(detailCellSelector); 
     detailCell.width(headerCell.width()); 
    }); 
} 

並初始化網格

gridDetailInit: function() { 
     resizeDetailGrid($('#grid')); 
    } 

你也可以添加一個水平滾動條到電網,如果你有這麼多列。

希望此信息有幫助。

+0

[只有鏈接回答非常皺眉](https://meta.stackexchange.com/a/8259/171858)。 –

0

爲了設置層次結構柵格的較小寬度,您可以顯式設置層次結構柵格組件的寬度。這可以通過HtmlAttributes屬性完成。

.HtmlAttributes(new {style="width: 500px;" })