SlidingZone - Undock all Panes

2 posts, 0 answers
  1. ryan86pika
    ryan86pika avatar
    5 posts
    Member since:
    Jun 2013

    Posted 17 Jul 2013 Link to this post

    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;
                        }
                    }
  2. Vessy
    Admin
    Vessy avatar
    1385 posts

    Posted 22 Jul 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top