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

Crea Grid - columns not resize

1 Answer 121 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Luciano
Top achievements
Rank 1
Luciano asked on 14 Feb 2018, 02:02 PM

I am creating a grid using AngularJS. The data is added correctly, but I can not configure the size of the columns. I'm setting the width in the code, but it does not seem to work.
Code:
<div kendo-grid 
                         k-data-source="frigobarGridOptions" 
                         k-selectable="'row'"
                         k-pageable='{ "pageSize": 5, "pageSizes": true }'
                         k-columns='[
                            { "field": "ItemId", "title": "Id", width: "130px"},
                            { "field": "Descricao", "title": "Descrição", width: "250px"},
                            { "field": "Quantidade", "title": "Quantidade", width: "100px" }
                      ]'>
</div>

Follow the screenshot of the grid.

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 16 Feb 2018, 11:15 AM
Hello Luciano,

This behavior is explained in the Grid Appearance article under Column Widths. Quoting the relevant piece of information:
When all columns have pixel widths, their sum exceeds the width of the Grid, and scrolling is enabled, a horizontal scrollbar appears. If that sum is less than the width of the Grid, the column widths are ignored and all columns expand. This leads to undesired side effects—for example, when resizing columns. In old Internet Explorer versions, the column widths are obeyed, but misalignment occurs. That is why it is recommended to have at least one column without a specified width, so that it can adjust freely. Set explicit widths for all columns only if they are set in percentage, or if their sum exceeds the width of the Grid and the goal is to achieve horizontal scrolling.

Try removing the width from the last column and then the rest of the columns should size according to their settings.

Regards,
Tsvetina
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Luciano
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or