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

Autosize column widths with scrollable virtual = true

2 Answers 266 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ed
Top achievements
Rank 1
Ed asked on 25 Jul 2014, 06:48 PM
In my grid, I am updating it to use the Virtualization of Remote Data (and removing the discrete paging via next/previous buttons).  In the code, I am changing from scrollable: false to scrollable: { virtual: true }.

The side effect of this is that my columns, which were sized according to the content (when scrollable was false) are now all the same width.  Note that I do not have any widths set on any of the columns.

What I would like is to be able to transition to virtual paging (virtual scolling or whatever it's called) and retain the auto width of the columns.

Thinking about it, it does make some sense.  You don't know the width of the data that has not yet been populated into the grid like you do with discrete pages (via next/previous buttons).  But, Kendo must have a method to autosize the columns to the content that I can, at the least, call myself to autosize in the dataBound event when the first page is done fetching data?

Thanks,
--Ed

2 Answers, 1 is accepted

Sort by
0
Ed
Top achievements
Rank 1
answered on 25 Jul 2014, 11:25 PM
I went to the Virtualization of Remote Data demo and edited it in the Dojo here (note, it conveniently includes widths for all columns):
http://dojo.telerik.com/@esinek/uGoM

If I remove the widths from all the columns we get all columns that are the same width
http://dojo.telerik.com/@esinek/ajIJ/2

If we then set scrollable to false, we get the columns auto width (which is nice)
http://dojo.telerik.com/@esinek/AmOB

if we simply set scrollable to true (not virtual), the columns are the same width again
http://dojo.telerik.com/@esinek/osOY

How can I use scrollable and have the columns auto-size like they do when scrollable is false?

Thanks,
--Ed
0
Accepted
Dimo
Telerik team
answered on 29 Jul 2014, 08:18 AM
Hi Ed,

The observed behavior is explained in the documentation:

http://docs.telerik.com/kendo-ui/getting-started/web/grid/walkthrough#column-widths

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
Ed
Top achievements
Rank 1
Answers by
Ed
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or