This is a migrated thread and some comments may be shown as answers.

Auto size grid

1 Answer 60 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 07 Aug 2013, 07:21 PM
There is a how-to article which covers auto-sizing the grid to it's container's height and width:
http://docs.kendoui.com/getting-started/web/grid/walkthrough#making-the-grid-100%-high-and-auto-resizable

$(window).resize(function() {
    var gridElement = $("#grid"),
        newHeight = gridElement.innerHeight(),
        otherElements = gridElement.children().not(".k-grid-content"),
        otherElementsHeight = 0;
 
    otherElements.each(function(){
        otherElementsHeight += $(this).outerHeight();
    });
 
    gridElement.children(".k-grid-content").height(newHeight - otherElementsHeight);
});

Is this still the best method of sizing the grid in this manner?

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 08 Aug 2013, 10:59 AM
Hello Robert,

Yes, it is.

In the future, we can consider including this algorithm in the Grid source, but the idea will remain pretty much the same.

Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Robert
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or