Resize splitter using javascript

2 posts, 0 answers
  1. David Penny
    David Penny avatar
    174 posts
    Member since:
    Jun 2006

    Posted 01 Dec 2011 Link to this post

    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.
  2. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 05 Dec 2011 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top