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

Expand/Collpase during OnClientLoaded

4 Answers 66 Views
Splitter
This is a migrated thread and some comments may be shown as answers.
bdk0172
Top achievements
Rank 1
bdk0172 asked on 11 Aug 2008, 03:49 PM
I have two panes separated by a splitbar.  When the user resizes or expands/collpases the splitbar, I'm saving the width of both panes in a cookie.  When the user returns to the page, I'm extracting the cookie information and setting the widths of each pane.  If either one of the widths returned from the cookie is '0', I set the corresponding pane to Collapse() and the other one to Expand().  

function OnClientLoadedHandler(splitter, args)

{

var leftWidthCookie = getCookie('leftPaneWidth');

var rightWidthCookie = getCookie('rightPaneWidth');

if (leftWidthCookie != null && rightWidthCookie != null)

{

var leftPane = splitter.getPaneById('<%= LeftPane.ClientID %>');

var rightPane = splitter.getPaneById('<%= RightPane.ClientID %>');

if (leftWidthCookie == '0')

{

leftPane.Collapse();

rightPane.Expand();

}

else if (rightWidthCookie == '0')

{

rightPane.Collpase();

leftPane.Expand();

}

else

{

leftPane.set_width(leftWidthCookie);

rightPane.set_width(rightWidthCookie);

}

}

}


The issue is that the user can't expand the collapsed pane, clicking on the arrow does nothing.  Does something else need to be set?  Ideally, I would like the splitbar to go to 50% width of the radSplitter so the user can then resize manually or be able to expand or collapse either pane.

Thanks!

4 Answers, 1 is accepted

Sort by
0
Tsvetie
Telerik team
answered on 13 Aug 2008, 12:09 PM
Hi bdk0172,
I was able to reproduce the problem you describe and forwarded it to our developers. For the time being, you can use a small timeout as a workaround:
function OnClientLoadedHandler(splitter, args)   
{  
    window.setTimeout(function(){  
 
    var leftWidthCookie = getCookie('leftPaneWidth');   
    var rightWidthCookie = getCookie('rightPaneWidth');   
    if (leftWidthCookie != null && rightWidthCookie != null)   
    {  
    var leftPane = splitter.getPaneById('<%= LeftPane.ClientID %>');   
    var rightPane = splitter.getPaneById('<%= RightPane.ClientID %>');   
    if (leftWidthCookie == '0')   
    {  
        leftPane.Collapse();  
        rightPane.Expand();  
    }   
    else if (rightWidthCookie == '0')   
    {  
        rightPane.Collpase();  
        leftPane.Expand();  
    }  
    else   
    {  
        leftPane.set_width(leftWidthCookie);  
        rightPane.set_width(rightWidthCookie);  
    }  
    }  
 
    },100);  
}  
 
 

Regards,
Tsvetie
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Juan_Massyn
Top achievements
Rank 1
answered on 11 Nov 2008, 01:44 PM
Hi.

I have a weird situation in the sense that I have a RadSplitter with a OnClientLoaded event which fires fine in my IE7 and Safari, but not in FireFox 3. Any idea why this is and how I can rectify this?



0
Obi-Wan Kenobi
Top achievements
Rank 1
answered on 11 Nov 2008, 06:01 PM
I tried the client-side events online example under Firefox and everything is ok.
You can find it here:
http://demos.telerik.com/ASPNET/Prometheus/Splitter/Examples/ClientSideEvents/DefaultCS.aspx 
0
Juan_Massyn
Top achievements
Rank 1
answered on 12 Nov 2008, 07:22 AM
Hi,

It was the weirdest thing. When the javascript function was added in the head of the page, FireFox did not find the function. Once I added it to a .js file and included it on the page, everthing worked fine. I think this is more a FireFox issue than a Telerik issue though.

Cheers,
Tags
Splitter
Asked by
bdk0172
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Juan_Massyn
Top achievements
Rank 1
Obi-Wan Kenobi
Top achievements
Rank 1
Share this question
or