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

Removing a TabPane from Sliding Zone

1 Answer 42 Views
Slider
This is a migrated thread and some comments may be shown as answers.
Ron Orbas
Top achievements
Rank 1
Ron Orbas asked on 18 Mar 2009, 04:36 PM
Hi there,

I wanted to delete a pane from sliding zone but I didn't see any functionality that lets you directly do this
on the client side (javascript). There is a  HideTab() method in the sliding pane but this doesn't really help
my cause because I have to make sure the pane is deleted. Can somebody show me how to appropriately
delete a pane from sliding zone on Client side? This is the closest i got to deleting a tab pane:
 

function deleteTab(TabName)

{

 

    var slidingZone = $find("<%= TreeSlidingZoneLeft.ClientID %>");

 

    var slidingPane = FindTabPaneByTitle(TabName);

 

 

 

 

    if(slidingPane != null)  

    {

        slidingZone.UndockPane(slidingPane.get_id());

        slidingPane.getTabContainer().removeNode(slidingPane);

        slidingPane.getContentContainer().removeNode(slidingPane);

        ArrayRemove(slidingZone._slidingPanes, index);

        slidingPane.HideTab();

 

 

    }

}
 

 

 

function ArrayRemove(array, from, to) { 

 

    var rest = array.slice((to || from) + 1 || array.length);

 

 

     array.length = from < 0 ? array.length + from : from;

 

   return array.push.apply(array, rest);

 

 

 

};

function FindTabPaneByTitle(TabName)

{

 

    var slidingPanes = getPanes();

 

 

 

    var slidingPane = null;

 

 

 

    for (var i = 0; i < slidingPanes.length; i++)

    {

        container = slidingPanes[i].GetTabContainer();

 

 

        if(container.title.toLowerCase() == TabName.toLowerCase())

        {

            index = i;

 

            slidingPane = slidingPanes[i];

 

            break;

        }

    }

 

 

 

    return slidingPane;

}

 

 

function getPanes()

{

 

    var slidingZone = $find("<%= TreeSlidingZoneLeft.ClientID %>");

 

 

 

    return slidingZone.getPanes();

}

Thanks,

James

 

 

 

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Tsvetie
Telerik team
answered on 20 Mar 2009, 02:38 PM
Hi James,
In the scenario you describe, you can refer to the RadSlidingPane as to a standard ASP.NET control and you can do with it everything that you can do with an ASP Label control for example. Unfortunately, as you yourself probably assume, you cannot remove an ASP Label control from the Controls collection of your page with client code. That is why you cannot do this with a RadSlidingPane as well.

The only thing that I can suggest in your case is that you make an AJAX request and remove the RadSlidingPane from the Items collection of the RadSlidingZone on the server.

All the best,
Tsvetie
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Slider
Asked by
Ron Orbas
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Share this question
or