We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Column width

Thread ID:





120263 Sep 15,2015 02:23 PM UTC Sep 16,2015 01:32 PM UTC ASP.NET Web Forms 1
Tags: TreeGrid
Cosimo Carbonelli
Asked On September 15, 2015 02:23 PM UTC

I would like to set the width of the column with javascript according to window size. I've tried the following javascript code but it does not work:
    var treegridObj = $("#treeGrid").data("ejTreeGrid");
    var numColumns = treegridObj.model.columns.length - 2;
    var swidth1 = $(window).width() - lOffset - rOffset;
    var colWidth = (swidth1 - 445) / numColumns;
    for (var i = 2; i < treegridObj.model.columns.length; i++) {
        treegridObj.model.columns[i].width = 10;
        treegridObj._columnsWidthCollection[i] = 10;

Can you help me? Thanks.
Best regards.

Jayakumar Duraisamy [Syncfusion]
Replied On September 16, 2015 01:32 PM UTC

Hi Cosimo,
Currently there is no built-in support in TreeGrid to change the width of the columns on resizing browser window, without re-rendering the TreeGrid widget . But we can provide a workaround for your requirement at present , please find the below code example to achieve your requirement,

var treegridObj = $("#Treegrid").data("ejTreeGrid");


                for (var i = 2; i < treegridObj.model.columns.length; i++) {

                    treegridObj.model.columns[i].width = 10;

                    treegridObj._columnsWidthCollection[i] = 10;    



In addition to that set EnableResize="true" for dynamic window resize.

We have prepared a sample regarding this , please find the sample in the below location,

Sample link: http://www.syncfusion.com/downloads/support/forum/120263/ze/TreeGridSample-1817366911
We have considered your requirement to change the column width dynamically on window resize as feature request and have logged a feature request regarding this.

A support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.


Please let us know if you require further assistance on this.
Jayakumar Duraisamy


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon