)
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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Essential JS2

Syncfusion jQuery based widgets are no longer in active development. Switch to our pure JavaScript based next generation Essential JS 2 library.

Syncfusion Feedback

How to toggle the splitter pane expand and collapse action?

Platform: jQuery |
Control: ejSplitter |
Published Date: January 30, 2018 |
Last Revised Date: June 27, 2019

Description

To toggle the split pane in any event at dynamically.

Solution

We can achieve this requirement using collapse and expand methods of splitter control. These public methods can be called from any events (for example button click event) to expand / collapse the pane of splitter by passing the index value of the required pane. On dynamic handler check for the expand/collapse state of the pane and toggle them using the methods.

1)If split pane (for example) has “collapsed” class, the pane is in collapsed state. Then, we can expand the pane by using expand method with passing the paneIndex argument.

2)If it has “expanded” class, the pane is in collapsed state. Then, we can collapse the pane by using collapse method with passing the paneIndex argument.   

Refer to the following code example:

[JavaScript]

$(function () {

           $("#outterSpliter").ejSplitter({

                height: "250px", width: "80%",

                orientation: ej.Orientation.Horizontal,

                properties: [{ paneSize: "50%" }],

                cssClass: "splitter"

            });

            $("#innerSpliter").ejSplitter({

                orientation: ej.Orientation.Vertical,

                properties: [{ paneSize: "50%" }]

            });

            //Object for inner splitter will be created like below

            innerSplitterObj = $("#innerSpliter").data("ejSplitter");

});

$("#collapse_button").bind("click", function () {

            innerSplitterObj.collapse(0);

});

$("#expand_button").bind("click", function () {

            innerSplitterObj.expand(0);

});

 

Final output

Nested Splitter

Sample

JavaScript

ASP .NET MVC

ASP .NET CORE

ASP .NET Web Forms

ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

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

Up arrow icon

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

Live Chat Icon For mobile
Live Chat Icon