Premium forums

Forums / Kendo UI Web / Grid / Grid Column width issue

Grid Column width issue

  • Khushali
    Khushali avatar

    16 Mar 2012 (Link to this post)

    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
  • Dimo
    Dimo avatar

    16 Mar 2012 (Link to this post)

    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!
  • Khushali
    Khushali avatar

    16 Mar 2012 (Link to this post)

    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
  • Dimo
    Dimo avatar

    16 Mar 2012 (Link to this post)

    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!

Read FAQ or see Kendo UI in action!

Launch Demos