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.
Unfortunately, activation email could not send to your email. Please try again.

Column width

Thread ID:

Created:

Updated:

Platform:

Replies:

120263 Sep 15,2015 10:23 AM Sep 16,2015 09:32 AM ASP.NET Web Forms 1
loading
Tags: TreeGrid
Cosimo Carbonelli
Asked On September 15, 2015 10:23 AM

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;
    }
    treegridObj.refreshContent();
    treegridObj.renderRecords();

Can you help me? Thanks.
Best regards.

Jayakumar Duraisamy [Syncfusion]
Replied On September 16, 2015 09:32 AM

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;    

                }


                treegridObj.setWidthToColumns();

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.

https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents

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


CONFIRMATION

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.

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.

;