Auto size column

1 Answer 20 Views
Top achievements
Rank 1
Ednaldo asked on 05 May 2022, 02:05 PM
Hello, do you have any column properties where the size is automatic?
In the example below I set the fixed size to 130px, the more accurate the size is automatic, according to the cell content.

getGridSettings: function () {       
        var settings = {
            excel: {
                allPages: true
            dataSource: GridAdmissionTrackerPublic.getGridDataSource(),
            navigatable: false,
            editable: true,
            sortable: true,
            scrollable: true,
            filterable: true,
            selectable: true,
            persistSelection: true,
            resizable: true,
            height: $(window).height() - 207,
            noRecords: {
                template: function (e) {
                    return "No items to display";
            pageable: {
                pageSizes: [30, 50, 100, 'All'],
                refresh: true
            columns: [
                    field: "StudentId",
                    title: "ID",
                    locked: true,
                    lockable: false,
                    resizable: true,
                    width: 130,
                    overflow: true,
                    minwidth: "100px",
                    minResizableWidth: 70,

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 10 May 2022, 06:33 AM

Hello Ednaldo,

If you omit the width property for all columns they will automatically fit within the table container.

Another option is to use the autoFitColumn() or autoFitColumns() methods which will apply the minimum possible width for the specified column or all so that all text fits without wrapping. Here is an article with a runnable example demonstrating this:

Hope this helps.

Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question