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

Prevent sliding zone from collapsing

1 Answer 38 Views
Splitter
This is a migrated thread and some comments may be shown as answers.
Russell Mason
Top achievements
Rank 1
Russell Mason asked on 11 Nov 2008, 11:52 AM
Hi

Is it possible to prevent a sliding zone from collapsing unless the user clicks the collapse 'x'? I want to do something similar to ClickToOpen, so that when the user clicks the tab the pane slides out and stays out. They must then explicitly click the 'x' collapse button to close it. I do not want to automatically dock the pane (i.e. I still want the pane to overlay the underlying content).

I can prevent the collapse entirely by using OnClientBeforeCollapse and set_cancel(true), but I cant work out how I know whether the user clicked the 'x' or its a timed collapse.

Thanks
Russell Mason

1 Answer, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 14 Nov 2008, 09:00 AM
Hello Russell,

In order to get the desired behavior I suggest to use a global boolean flag variable and change its value when needed - you will determine whether to allow or cancel the collapsing by using it. I prepared for you the following sample script:

 
        <script type="text/javascript">  
        var flag = true;   
        function HandleClose()  
        {  
          var icon = $find("slide1").getCollapseIconElement();  
          icon.onclick = CloseFn;  
        }  
        function CloseFn()  
        {  
          flag = false;  
          $find("zone").collapsePane("slide1");  
        }  
        function OnClientBeforeCollapse(sender, args)  
        {  
          args.set_cancel(flag);  
        }  
        function OnClientExpanded()  
        {  
          flag = true;  
        }  
          
        </script> 

For your convenience I attached my tets project, feel free to extend it further in order to meet your needs.



All the best,
Svetlina
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Splitter
Asked by
Russell Mason
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Share this question
or