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

[Solved] Layout with razor syntax at 100% issue

3 Answers 161 Views
Splitter
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
figueiredorj
Top achievements
Rank 1
figueiredorj asked on 16 Aug 2011, 11:01 PM
Hi all.

I am trying to define an aplication layout with 2 containers full page - a menu on left and a full div on right side.
This is my code:
<head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" charset="utf-8" />
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/CustomSite.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.6.2.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script>
    <style type="text/css">
        html, body, form
        {
            height: 100%;
            margin: 0px;
            padding: 0px;
            overflow: hidden;
        }
    </style>
    @RenderSection("Scripts", false)
    @RenderSection("Styles", false)
    @(Html.Telerik().StyleSheetRegistrar()
                      .DefaultGroup(group => group
                          .Add("telerik.common.css")
                          .Add("telerik.transparent.min.css")
                          .Combined(true)
                          .Compress(true))
                     )
</head>
<body>
    @{Html.Telerik().Splitter().Name("Splitter")
        .HtmlAttributes(new { style = "height: 100%" })
        .Orientation(SplitterOrientation.Horizontal)
        .Panes(panes =>
                   {
                       panes.Add()
                           .MinSize("300px")
                           .Size("300px")
                           .MaxSize("300px")
                           .HtmlAttributes(new { style = "height:100%" })
                           .Collapsible(true)
                           .Resizable(false)
                           .Content(content => @Html.Partial("_Menu"));
                       panes.Add()
                           .Resizable(false)
                           .Collapsible(false)
                           .HtmlAttributes(new { style = "height:100%" })
                           .Content(content => @RenderBody());
 
                   })
        .Render();
    }
    @Html.Telerik().ScriptRegistrar().jQuery(false)
</body>
</html>

At first look all seems okay. When page is loaded it is all window size and looks okay.
Problem is when I resize window: I should expect it to also resize with window, since I set styles to percentage.
Unfortunaley it doesn't happen.

When I look code on firebug the properties are set on pixels, so it doesn't resize on window resize.
Am I doing something not so good or is something missing? Or do I have to tweak with JS?
I would apreciate some help on this issue.

Thanks

3 Answers, 1 is accepted

Sort by
0
Accepted
Alex Gyoshev
Telerik team
answered on 17 Aug 2011, 08:02 AM
Hi Figueiredorj,

You need to call the splitter resize() method to make the splitter adhere to its new size:

window.onresize = function() {
    $("#Splitter").data("tSplitter").resize();
};


All the best,
Alex Gyoshev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

0
figueiredorj
Top achievements
Rank 1
answered on 17 Aug 2011, 09:23 AM
Many many thanks.
Worked like  a charm.. I was tired of tweaking styles!
0
Alex
Top achievements
Rank 1
answered on 09 Feb 2012, 10:38 PM
Worked great.  IE9 in compatibility didn't need this fix.  Resizing seems to work automatically there.  But non-compatibility mode and Chrom need this fix.

Here's what I got:

<script type="text/javascript">
    window.onresize = function () {
        $("#Splitter1").data("tSplitter").resize();
    };   
</script>
 
@{Html.Telerik().Splitter().Name("Splitter1")
 ..... the rest
Tags
Splitter
Asked by
figueiredorj
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
figueiredorj
Top achievements
Rank 1
Alex
Top achievements
Rank 1
Share this question
or