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

Grid Column width issue

3 Answers 1134 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Khushali
Top achievements
Rank 1
Khushali asked on 16 Mar 2012, 11:27 AM
Hi,

Can we specify width for individual columns in column definition? I tried giving width in definition this way:

 _SearchColumns = [{
            field: "docId",
            title: "DOC ID",
            width: "100px"
        },{
            field: "docType",
            title: "DOC TYPE",
            width: "80px"
        }]

But, it is working only when i give scrollable true. I dont want to give scrollable true. Just want to adjust the column widths as there are so many columns in the grid.Also when the width is getting applied, the text is getting cropped. Is there any option to resize the column so that the text becomes visible? Please suggest.

Thanks,
Khushali

3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 16 Mar 2012, 12:33 PM
Hi Khushali,

Column widths may be ignored due to two reasons:

1) incorrect configuration, e.g. the sum of all column widths is smaller than the width of the Grid. In such cases it is good to leave one column without a width, so that it expands as much as needed;
2) the column content is too large to fit in the specified width;

Enabling Grid scrolling applies a table-layout:fixed style to the table elements, which enforces the column widths even in case (2) above. However, you can't make the columns expand automatically in this scenario - this is possible only in auto table layout.

Regards,
Dimo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Khushali
Top achievements
Rank 1
answered on 16 Mar 2012, 12:48 PM
Hi Dimo,

I have not given width right now to the grid or to the div in which the grid is getting created. But still it is not taking widths. For time being i have just given overflow:auto to the grid div and a max-width. But doing that way, the pager css is not coming properly. What can i do in this case?

Regards,
Khushali
0
Dimo
Telerik team
answered on 16 Mar 2012, 04:23 PM
Hello Khushali,

It doesn't matter whether you set width to the Grid or not - it still occupies some space.

Since I cannot fully understand what the problem is, I suggest you to provide a runnable web page for me to test locally.

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