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.

Set the size by javascript

Thread ID:

Created:

Updated:

Platform:

Replies:

123187 Feb 24,2016 11:25 AM Feb 25,2016 07:44 AM ASP.NET Web Forms 1
loading
Tags: TreeGrid
Jorge Pampin
Asked On February 24, 2016 11:25 AM

Hello,

How to change the size of a TreeControl by JavaScript?

Thanks!

Mahalakshmi Karthikeyan [Syncfusion]
Replied On February 25, 2016 07:44 AM

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" />

</ej:TreeGrid>


<script type="text/javascript">

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

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

            var size = { width: '500' } ;

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

        })

    </script>

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

Regards,

Mahalakshmi K.


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.

;