[CLOSED] Page layout in IFrame and resize issue

  1. #1

    [CLOSED] Page layout in IFrame and resize issue

    Hi:

    I am trying to load a chart from ExtJs 4 in Ext.Net
    I have a panel as IFrame to load a page.
                                   <ext:Panel ID="Panel2" runat="server" Height="250">
                                            <TopBar>
                                                <ext:Toolbar ID="Toolbar1" runat="server" Layout="Container">
                                                    <Items>
                                                        <ext:Toolbar ID="Toolbar2" runat="server">
                                                            <Items>
                                                                <ext:ComboBox ID="ComboBoxItemType" runat="server" SelectedIndex="0" Editable="false">
                                                                    <Items>
                                                                        <ext:ListItem Text="<%$Resources: Strings, CoreTaskWorkIn%>" Value="ct" />
                                                                        <ext:ListItem Text="<%$Resources: Strings, DivertedTasks%>" Value="dt" />
                                                                        <ext:ListItem Text="<%$Resources: Strings, Downtimes%>" Value="dn" />
                                                                        <ext:ListItem Text="<%$Resources: Strings, Resources%>" Value="rs" />
                                                                        <ext:ListItem Text="<%$Resources: Strings, Productivity%>" Value="pr" />
                                                                    </Items>
                                                                    <Listeners>
                                                                        <Select Fn="forecast.taskTypeItemChange" Delay="100"></Select>
                                                                    </Listeners>
                                                                </ext:ComboBox>
                                                                <ext:ComboBox ID="ComboBoxItemList" runat="server" SelectedIndex="0" Editable="false"
                                                                    StoreID="StoreTaskItemList" DisplayField="Name" ValueField="Id">
                                                                    <Listeners>
                                                                        <Select Fn="forecast.taskItemChange" Delay="100"></Select>
                                                                    </Listeners>
                                                                </ext:ComboBox>
                                                                <ext:Button ID="BtnNext" runat="server" Text="<%$Resources: Strings, Next%>" StandOut="true"
                                                                    Icon="NextGreen">
                                                                    <Listeners>
                                                                        <Click Fn="forecast.nextButtonClick"></Click>
                                                                    </Listeners>
                                                                </ext:Button>
                                                                <ext:ToolbarFill runat="server" />
                                                                <ext:RadioGroup ID="RadioGroupTrend" runat="server" Width="300">
                                                                    <Items>
                                                                        <ext:Radio runat="server" ID="PlanUnitTrend" BoxLabel="<%$Resources: Strings, PlanUnitTrend%>">
                                                                        </ext:Radio>
                                                                        <ext:Radio runat="server" ID="Trend" BoxLabel="<%$Resources: Strings, Trend%>" Checked="true">
                                                                        </ext:Radio>
                                                                    </Items>
                                                                    <Listeners>
                                                                        <Change Fn="forecast.chartTrendChange" Delay="1"></Change>
                                                                    </Listeners>
                                                                </ext:RadioGroup>
                                                                <ext:ComboBox ID="ComboBoxGraphUnit" runat="server" Editable="false" SelectedIndex="0"
                                                                    StoreID="StorePlanRange" DisplayField="Name" ValueField="PlanRangeId" TriggerAction="All">
                                                                </ext:ComboBox>
                                                            </Items>
                                                        </ext:Toolbar>
                                                    </Items>
                                                </ext:Toolbar>
                                            </TopBar>
                                            <AutoLoad Url="~/Planning/Forecast/Chart" Mode="IFrame" ShowMask="true" NoCache="true" PassParentSize="true">
                                            </AutoLoad>
                                        </ext:Panel>
    The page is:
    <html xmlns="http://www.w3.org/1999/xhtml">
        <head runat="server">
            <title>Line Chart</title>
            <script type="text/javascript" src="../../Scripts/ExtJs4/ext-all.js" />
            <script type="text/javascript">
                Ext.Loader.setConfig({
                    enabled: true,
                    disableCaching: true,
                    paths: { 'Ext': "/Scripts/ExtJs4/src/" }
                });
            </script>
            <link rel="stylesheet" type="text/css" href="../../../../Scripts/ExtJs4/ext-all.css" />
            <link rel="stylesheet" type="text/css" href="../../../../Scripts/ExtJs4/example.css" />
            <script type="text/javascript" src="../../Scripts/ExtJs4/example-data.js"></script>
            <script type="text/javascript" src="../../Scripts/ExtJs4/Line.js"></script>
        </head>
        <body id="docbody">
        </body>
    </html>
    The Line.js file is:
    Ext.require('Ext.chart.*');
    Ext.require(['Ext.Panel', 'Ext.fx.target.Sprite', 'Ext.layout.container.Fit']);
    
    Ext.onReady(function () {
        store1.loadData(generateData(8));
        
        var win = Ext.create('Ext.Panel', {
            width: 800,
            height: 600,
            hidden: false,
            border: true,
            renderTo: Ext.getBody(),
            layout: 'fit',
            items: {
                xtype: 'chart',
                style: 'background:#fff',
                animate: true,
                store: store1,
                shadow: true,
                theme: 'Category1',
                legend: {
                    position: 'right'
                },
                axes: [{
                    type: 'Numeric',
                    minimum: 0,
                    position: 'left',
                    fields: ['data1', 'data2', 'data3'],
                    title: 'Number of Hits',
                    minorTickSteps: 1,
                    grid: {
                        odd: {
                            opacity: 1,
                            fill: '#ddd',
                            stroke: '#bbb',
                            'stroke-width': 0.5
                        }
                    }
                }, {
                    type: 'Category',
                    position: 'bottom',
                    fields: ['name']
                }],
                series: [{
                    type: 'line',
                    highlight: {
                        size: 7,
                        radius: 7
                    },
                    axis: 'left',
                    xField: 'name',
                    yField: 'data1',
                    markerConfig: {
                        type: 'cross',
                        size: 4,
                        radius: 4,
                        'stroke-width': 0
                    }
                }, {
                    type: 'line',
                    highlight: {
                        size: 7,
                        radius: 7
                    },
                    axis: 'left',
                    smooth: true,
                    xField: 'name',
                    yField: 'data2',
                    markerConfig: {
                        type: 'circle',
                        size: 4,
                        radius: 4,
                        'stroke-width': 0
                    }
                }, {
                    type: 'line',
                    highlight: {
                        size: 7,
                        radius: 7
                    },
                    axis: 'left',
                    smooth: true,
                    fill: true,
                    xField: 'name',
                    yField: 'data3',
                    markerConfig: {
                        type: 'circle',
                        size: 4,
                        radius: 4,
                        'stroke-width': 0
                    }
                }]
            }
        });
    });
    When I load the page, the chart can be display but the layout doesn't look good. I have couple questions.
    1. In the javascript file, how could I set the panel's width and height based on the value from the panel which has IFrame?
    2. I set the layout value of panel with chart to "Fit" but there is still some white space in the panel. To maximum use of the page space, how could I fill in the page with chart?
    3. If I resize the browser, how could I let the chart to be resize as well?

    Sorry about many questions, Thank you
    Last edited by Daniil; Nov 25, 2011 at 8:50 AM. Reason: [CLOSED]
  2. #2
    Hi,

    Please clarify the following thing: the Panel2's Height is 250, but you set up 'height: 600' for the panel with the chart.

    1. In the javascript file, how could I set the panel's width and height based on the value from the panel which has IFrame?
    The parent's width and height are sent in a query string.

    2. I set the layout value of panel with chart to "Fit" but there is still some white space in the panel. To maximum use of the page space, how could I fill in the page with chart?
    3. If I resize the browser, how could I let the chart to be resize as well?
    I can suggest to use a Viewport with as a top level widget. Sure, with a 'fit' layout.
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi,

    Please clarify the following thing: the Panel2's Height is 250, but you set up 'height: 600' for the panel with the chart.



    The parent's width and height are sent in a query string.



    I can suggest to use a Viewport with as a top level widget. Sure, with a 'fit' layout.
    1. I have to set some value for height otherwise there is javascript error on the page but once I can get the height from query string so this should not be problem anymore.

    2. Could you please give me a example how to create a viewport as a top level widget with 'fit' layout in client side?

    Thank you
  4. #4
    Hi,

    The following sample demonstrates configuring an <ext:Viewport>, see

    https://examples1.ext.net/#/ViewPort...ilt_in_Markup/

    You can just replace the .Layout="BorderLayout" with .Layout="FitLayout".

    There's lots of Viewport demos as part of other samples in the Examples Explorer as this is a very common Component to use.

    Hope this helps.
    Geoffrey McGill
    Founder
  5. #5
    Geoffrey, please note that @leon_tang uses ExtJS 4 on a chart page.

    Well, here is an example with "border" layout.
    http://docs.sencha.com/ext-js/4-0/#!...ainer.Viewport

    Just change to "fit" and put a Panel to items.
  6. #6
    Quote Originally Posted by Daniil View Post
    Geoffrey, please note that @leon_tang uses ExtJS 4 on a chart page.

    Well, here is an example with "border" layout.
    http://docs.sencha.com/ext-js/4-0/#!...ainer.Viewport

    Just change to "fit" and put a Panel to items.
    Add the viewport as top container, issue solved. Thank you

Similar Threads

  1. [CLOSED] Portal Layout Resize Issues
    By Patrick_G in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 18, 2013, 3:50 AM
  2. [CLOSED] Layout issue with iframe window in desktop
    By Labyrinth in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Nov 01, 2010, 2:58 PM
  3. [CLOSED] [1.0] Resize Border layout issues
    By ashton.lamont in forum 1.x Legacy Premium Help
    Replies: 9
    Last Post: Oct 26, 2010, 7:17 PM
  4. [CLOSED] [1.0] Fit Layout in dialog does not resize
    By jchau in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jun 04, 2010, 8:41 PM
  5. Replies: 3
    Last Post: Feb 22, 2009, 2:58 PM

Posting Permissions