This is a migrated thread and some comments may be shown as answers.

SlidingZone - Undock all Panes

1 Answer 8 Views
Splitter
This is a migrated thread and some comments may be shown as answers.
ryan86pika
Top achievements
Rank 1
ryan86pika asked on 17 Jul 2013, 10:32 AM
var slidingZone = $find("<%= SlidingZone1.ClientID %>");
                var panes = slidingZone.getPanes();
 
                var id = 0;
                var result = false;
                var paneID = panes[id]._clientStateFieldID;
 
                while (panes[id] != null) {
                    var isDocked = panes[id].get_docked();
                    if (isDocked) {
                        result = slidingZone.UndockPane(paneID);
                    }
                    id++;
                    if (panes[id] != null) {
                        paneID = panes[id]._clientStateFieldID;
                    }
                }

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 22 Jul 2013, 09:12 AM
Hi Ryan,

The following changes should be made in order to make the above function work:
  • you should use the clientId of the SlidingPanes instead of the clientStateFieldID:
    var paneID = panes[id].get_id();
  • the Client undockPane() method should be used instead of UndockPane()
    slidingZone.undockPane(paneID)

The function with the changes:

function collapseAllPanes() {
    var slidingZone = $find("<%= RadSlidingZone1.ClientID %>");
    var panes = slidingZone.getPanes();
 
    var id = 0;
    var result = false;
    var paneID = panes[id].get_id(); //_clientStateFieldID;
 
    while (panes[id] != null) {
        var isDocked = panes[id].get_docked();
        if (isDocked) {
            result = slidingZone.undockPane(paneID);
        }
        id++;
        if (panes[id] != null) {
            paneID = panes[id].get_id();//_clientStateFieldID;
        }
    }
}

Furthermore, you could optimize the function in the following way:
function collapseAllPanes() {
    var slidingZone = $find("<%= RadSlidingZone1.ClientID %>");
    var panes = slidingZone.getPanes();
    var isDocked;
 
    for (var i = 0; i < panes.length; i++) {
        isDocked = panes[i].get_docked();
 
        if (isDocked) {
            slidingZone.undockPane(panes[i].get_id());
        }
    }
}

Here you could find detailed information regarding the RadSlidingZone and RadSlidingPane Client object APIs.

I hope this would help.

Regards,
Veselina Raykova
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Splitter
Asked by
ryan86pika
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Share this question
or