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

Resize splitter using javascript

1 Answer 78 Views
Splitter
This is a migrated thread and some comments may be shown as answers.
David Penny
Top achievements
Rank 2
David Penny asked on 01 Dec 2011, 11:51 AM
I have a splitter control within a User control on a page containing two panes with a grid in each and am trying to size the splitter control on load to fit the available space. I have added a hook to the javascript function with OnClientLoaded="sizeSplitter".

The javascript I'm using is:

function sizeSplitter(sender, args) {
                var w = browserWidth() - 10;
                var h = browserHeight() - 200;
                alert('height=' + h + ' width=' + w);
                sender.get_element().style.height = h;
                sender.get_element().style.width = w;
            }

This returns the browser width and height fine and displays them using the alert, but the splitter seems to be stubbornly remaining the same size as defined.

1 Answer, 1 is accepted

Sort by
0
Dobromir
Telerik team
answered on 05 Dec 2011, 01:40 PM
Hi David,

In order to manually size the splitter on the client you need to use RadSplitter's client-side methods set_width() / set_height() / resize(), e.g.:
function sizeSplitter(sender, args)
{
    var w = browserWidth() - 10;
    var h = browserHeight() - 200;
    alert('height=' + h + ' width=' + w);
    sender.resize(w, h);
}

You can find more information regarding RadSplitter's Client-Side API in the following help article:
RadSplitter Client Object

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
Tags
Splitter
Asked by
David Penny
Top achievements
Rank 2
Answers by
Dobromir
Telerik team
Share this question
or