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

Percentage Widths Cause Error

6 Answers 201 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Rob
Top achievements
Rank 1
Rob asked on 01 Oct 2012, 01:31 PM
Version 2012.2.912.40

I'm working with the RadHTMLChart and wanted to dynamically modify a piechart.  Thus, I updated our working Telerik dlls to the latest version.

However, now our rad docks are erroring when being moved on the screen and the layout saved.

I've identified an issue that didn't happen with earlier versions.  Namely, the containing space for the docks must be a whole number (integer) instead of a decimal.  I have my left dock zone in an area of 33% of the screen and the other the remainder.  If I used specified widths, I do not get an error.

EDIT:  I should note that the percentage value widths are on containers that the dock zones are within.

Trying to move a dock errors with variable (percentage) widths:

  1. Uncaught Sys.ArgumentOutOfRangeException: Sys.ArgumentOutOfRangeException: Value must be an integer. Parameter name: x Actual value was 530.4500122070312. ScriptResource.axd:237
    1. Error$argumentOutOfRangeScriptResource.axd:302
    2. Function$_validateParameterTypeScriptResource.axd:217
    3. Function$_validateParameterScriptResource.axd:130
    4. Function$_validateParamsScriptResource.axd:84
    5. Telerik.Web.UI.RadDock._getLocationScriptResource.axd:430
    6. Telerik.Web.UI.RadDock._startDragDropScriptResource.axd:178
    7. Telerik.Web.UI.RadDock.onDragStartScriptResource.axd:191
    8. b.ResizeExtender._raiseDragEventScriptResource.axd:450
    9. b.ResizeExtender._storeStartCoordsScriptResource.axd:484
    10. b.ResizeExtender._onHandleMouseDownScriptResource.axd:597
    11. (anonymous function)

6 Answers, 1 is accepted

Sort by
0
Jeff
Top achievements
Rank 1
answered on 01 Oct 2012, 07:48 PM
Just adding my two cents' worth...I've noticed the exact same problem, but the docks function fine in IE9.  For me, the dragging issue is only happening in Firefox.
0
Rob
Top achievements
Rank 1
answered on 01 Oct 2012, 08:14 PM
I'm seeing the error in Chrome and FireFox.  IE will typically work but not always.
0
Rob
Top achievements
Rank 1
answered on 02 Oct 2012, 01:30 PM
My temporary solution thus far is to resize with containers around the zones on load and resize of the browser window.  By rounding the width I ensure it is always a whole number value and never a decimal.

addLoadEvent(SetZoneWidths);
addResizeEvent(SetZoneWidths);
function SetZoneWidths() {
    var containerWidth = $telerik.$('#divDashboardLayout').width();
    $telerik.$('#divLeftZone').width(Math.round(containerWidth * .33));
    $telerik.$('#divRightZone').width(Math.round(containerWidth * .65));
}
0
Slav
Telerik team
answered on 04 Oct 2012, 08:19 AM
Hello Robert,

I tried to reproduce the problem you reported, but it appears that I am missing something. I have attached my test sample to this post. Please compare it with your actual project and let me know if there are differences in the setup. Here you can observe the behavior of RadDock on my end.

Note that I am mostly guessing as to what your setup is. Please try modifying the attached sample so that it matches your scenario and send it via support ticket. If this is not possible, you can also isolate the problem in a simple, fully runnable project, which will allow me to inspect it locally and provide a more to the point answer.

Greetings,
Slav
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
Rob
Top achievements
Rank 1
answered on 04 Oct 2012, 04:07 PM
Hi Slav,

Sorry I wasn't more clear.  I appreciate your setting up the sample.  I've updated it to be in line with mine so you can see the issue I'm encountering.  I tested on my side and got the same "must be an integer" javascript errors.

Perhaps there's a better way to create percentile based width dock zones that float beside one another?

Thanks.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="RadDockSample.aspx.cs" Inherits="RadDockSample" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="Scriptmanager1" runat="server" />
    <telerik:RadDockLayout runat="server" ID="RadDockLayout1" OnLoadDockLayout="RadDockLayout_LoadDockLayout"
        OnSaveDockLayout="RadDockLayout_SaveDockLayout">
        <div style="width: 33%;float:left;">
            <telerik:RadDockZone runat="server" ID="RadDockZone1" Orientation="Vertical" MinHeight="800px" MinWidth="250px" BorderStyle="None">
                <telerik:RadDock runat="server" ID="RadDockl" AutoPostBack="true" DockMode="Docked" >
                </telerik:RadDock>
            </telerik:RadDockZone>
        </div>
        <div style="width: 65%;float:left;">
            <telerik:RadDockZone runat="server" ID="RadDockZone2" Orientation="Vertical" MinHeight="800px" MinWidth="250px" BorderStyle="None">
                <telerik:RadDock runat="server" ID="RadDock2" AutoPostBack="true" DockMode="Docked" >
                </telerik:RadDock>
            </telerik:RadDockZone>
        </div>
    </telerik:RadDockLayout>
    </form>
</body>
</html>
0
Slav
Telerik team
answered on 09 Oct 2012, 10:43 AM
Hello Robert,

Thank you very much for the provide code sample!

The problem you encountered appears to be a bug in RadDock and it occurs when the left or top offset of the control is not an integer as in your case. I have brought this issue to the attention of our developers, however I cannot provide a firm estimate when a fix will be available. You can track the status of the problem via the PITS Issue that I have logged.

For the time being you can resolve the issue by adding the following override before the closing form tag on your page:
<script type="text/javascript">
    Telerik.Web.UI.RadDock.prototype._getLocation = function (element)
    {
        if (!element) element = this.get_element();
        var elOffset = $telerik.$(element).offset();
 
        return new Sys.UI.Point(parseInt(elOffset.left), parseInt(elOffset.top));
    }
 
    Telerik.Web.UI.RadDockZone.prototype._getLocation = function (element)
    {
        if (!element) element = this.get_element();
        var elOffset = $telerik.$(element).offset();
 
        return new Sys.UI.Point(parseInt(elOffset.left), parseInt(elOffset.top));
    }
</script>

I have updated your Telerik points as a token of gratitude for reporting the problem.

Greetings,
Slav
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
Dock
Asked by
Rob
Top achievements
Rank 1
Answers by
Jeff
Top achievements
Rank 1
Rob
Top achievements
Rank 1
Slav
Telerik team
Share this question
or