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. Image for the cookie policy date

Set the size by javascript


How to change the size of a TreeControl by JavaScript?


1 Reply

MK Mahalakshmi Karthikeyan Syncfusion Team February 25, 2016 12:44 PM UTC

Hi Jorge,

We can set the size to TreeGrid using javascript with the help of setModel. Please refer the below code example for details.

<button id="size">Change Size</button>

<ej:TreeGrid ID="Treegrid" runat="server" //… >


        <SizeSettings Width="100%" Height="500px" />


<script type="text/javascript">

        $("#size").click(function () {

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

            var size = { width: '500' } ;

            obj.setModel({ "sizeSettings": size })



Here at the load time we have rendered the TreeGrid width as 100% to the document and at the button click we have changed the TreeGrid width as 500 pixel using setModel.

We have also prepared a sample based on this and you can find the sample under the following location.

Sample:  http://www.syncfusion.com/downloads/support/directtrac/general/ze/SizeSettings905695090

Note: We have removed bin and obj folder in the given sample for some security reasons, we must include Syncfusion.EJ and Syncfusion.EJ.Web dlls to render the TreeGrid control which is available in Essential studio installed location


Mahalakshmi K.

Live Chat Icon For mobile
Up arrow icon