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

showing a hidden RadSplitBar does not work

2 Answers 83 Views
Splitter
This is a migrated thread and some comments may be shown as answers.
Paul Evers
Top achievements
Rank 2
Paul Evers asked on 01 Mar 2012, 04:24 PM
Hi,

I have a RadSplitter (version Q1 2012) with two panes and one splitbar.
At server-side I am hidding pane 2 and the splitbar

pane2.Collapsed = true;
splitbarTop.Visible = false;

I want to show pane2 and the splitbar on the clientside in javascript

var pane = splitter.getPaneById("pane2");
var splitbar = $get(splitbarTop);
pane.expand();
splitbar.style.display = "";

pane.expand works correct.

The code for showing the splitbar is producing an error in IE9:
"Microsoft JScript runtime error: Unable to get value of the property 'style': object is null or undefined"

How can I show and hide a splitbar in jacascript?

Paul

2 Answers, 1 is accepted

Sort by
0
Dobromir
Telerik team
answered on 05 Mar 2012, 06:15 PM
Hi Paul,

RadSplitter does not offer the possibility to hide / show and/or dynamically add splitbars to the splitter client-side (using JavaScript). The error that you experience is due to the fact that the Visible property of the RadSplitBar is set to false. In such case the control is not rendered on the page at all.

To achieve the required result I would suggest you to change the splitbar's visibility and pane collapse / expand state on the server using an AJAX request.

All the best,
Dobromir
the Telerik team
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 their blog feed now.
0
Paul Evers
Top achievements
Rank 2
answered on 06 Mar 2012, 09:09 AM
I have solved this in the following manner:

For opening a panel in jQuery:
function CallPage(url, target, preset) {
    var splitterT = $find("splitterTop");
    if (target == "1") {
        var pane1 = splitterT.getPaneById("pane1");
        pane1.set_contentUrl(urlNew);
    }
    else if (target == "2") {
        var pane2 = splitterT.getPaneById("pane2");
  
        pane2.expand();
        pane2.set_contentUrl(urlNew);
  
        var splitbarT = splitterT.getSplitBarById("splitbarTop").get_element();
        splitbarT.style.borderRightWidth = "4px";
    }
}

For closing a panel in jQuery:
function ClearSplitterPane(target) {
    if (target == "1") {
        var splitterT = $find("splitterTop");
        var pane1 = splitterT.getPaneById("pane1");
        pane1.set_contentUrl("");
    }
    else if (target == "2") {
        var splitterT2 = $find("splitterTop");
        var pane2 = splitterT2.getPaneById("pane2");
        pane2.set_contentUrl("");
        pane2.collapse();
 
        var splitbarT = splitterT2.getSplitBarById("splitbarTop").get_element();
        splitbarT.style.borderRightWidth = "0px";
    }
}

I set the borderRightWidth (in case the orientation of the splitter is vertical; if the orientation is horizontal you must use borderBottomWidth instead).

Paul
Tags
Splitter
Asked by
Paul Evers
Top achievements
Rank 2
Answers by
Dobromir
Telerik team
Paul Evers
Top achievements
Rank 2
Share this question
or