[CLOSED] Javascript function after loading portlet

  1. #1

    [CLOSED] Javascript function after loading portlet

    I'm using a portal with few portlet in an MVC master page like this
                        <ext:Panel ID="pnlPortal" runat="server" Title="Performance Indicators" Layout="Fit">
                            <Items>
                                <ext:Portal ID="Portal1" runat="server" Border="false" Layout="Column">
                                    <Items>
                                        <ext:PortalColumn ID="PortalColumn1" runat="server" Cls="x-column-padding" ColumnWidth=".33"
                                            Layout="Anchor">
                                            <Items>
                                                <ext:Portlet ID="prtVendite" runat="server" Title="Andamento Vendite" Icon="ChartBar" Height="350">
                                                    <Loader ID="Loader5" runat="server" Url="~/Charts/Selling" Mode="Frame" />
                                                 </ext:Portlet>
                                                <ext:Portlet ID="prtProgetti" runat="server" Title="Andamento Progetti" Icon="ChartLine"  Height="350" >
                                                    <Loader ID="Loader4" runat="server" Url="~/Charts/Projects" Mode="Html" />
                                                </ext:Portlet>
                                            </Items>
                                        </ext:PortalColumn>
                                        <ext:PortalColumn ID="PortalColumn2" runat="server" Cls="x-column-padding" ColumnWidth=".33"
                                            Layout="Anchor">
                                            <Items>
                                                <ext:Portlet ID="prtAnnotations" runat="server" Title="Annotations" Icon="ChartLineLink" Height="350" >
                                                    <Loader ID="Loader3" runat="server" Url="~/Charts/Annotations" Mode="Frame" />
                                                </ext:Portlet>
                                               <ext:Portlet ID="prtPie" runat="server" Title="Pie Test" Icon="ChartPieLightning"  Height="650" >
                                                    <Loader ID="Loader2" runat="server" Url="~/Charts/PieChart" Mode="Component" />
                                                </ext:Portlet>
                                            </Items>
                                        </ext:PortalColumn>
                                        <ext:PortalColumn ID="PortalColumn3" runat="server" Cls="x-column-padding1" ColumnWidth=".33"
                                            Layout="Anchor">
                                            <Items>
                                                <ext:Portlet ID="Portlet1" runat="server" Title="Andamento Costi" Icon="ChartLineError" Height="350" >
                                                    <Loader ID="Loader1" runat="server" Url="~/Charts/Calls" Mode="Frame" />
                                                </ext:Portlet>
                                            </Items>
                                        </ext:PortalColumn>
                                    </Items>
                                </ext:Portal>
    If I use the "Frame" mode no problem but if I use a partial view I'm not able to attach to some javascript handler to modify the dom. I wrote a very simple of the projects.ascx partial view like this one
    <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    
    <ext:Panel ID="InnerPanel1" runat="server" Title="Panel" Html="Prova">
    <Listeners>
    <BeforeActivate Fn="alert('beforeActivate');" />
    <AfterLayout  Fn="alert('AfterLayout');" />
    <BeforeCollapse Fn="alert('AfterLayout');" />
    </Listeners>
    </ext:Panel>
    <script type="text/javascript">
        var setChart = function () {
            alert('Started');
        };
    </script>
    but no joy :( Any help?

    thanks
    mario
    Last edited by Daniil; Jul 25, 2012 at 1:57 AM. Reason: [CLOSED]
  2. #2
    Hi,

    Please use the Load listener of the Loader.

    Example
    <Loader runat="server">
        <Listeners>
            <Load Handler="alert('Load');" />
        </Listeners>
    </Loader>
  3. #3
    Thanks Daniil but it doesn't work this is the shortened sample
    In MasterPage:
    <ext:PortalColumn ID="PortalColumn2" runat="server" Cls="x-column-padding" ColumnWidth=".33" Layout="Anchor">
    <Items>
          <ext:Portlet ID="prtPie" runat="server" Title="Pie Test" Icon="ChartPieLightning"  Height="650" >
              <Loader ID="Loader2" runat="server" Url="~/Charts/PieChart" Mode="Html" />
          </ext:Portlet>
    </Items>
    </ext:PortalColumn>
    ~/Charts/PieChart is a partial view like this
    <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    
    <ext:Panel ID="InnerPanel1" runat="server" Title="Panel" Html="Prova">
    <Loader ID="Loader1" runat="server">
        <Listeners>
            <Load Handler="alert('Load');" />
        </Listeners>
    </Loader>
    </ext:Panel>
    but nothing happens :( Could you help me?

    thanks in advance
  4. #4
    You should set up the Load listener of the Loader2.
  5. #5
    Hi Daniil now it works. I already tried to set the listener in loader2 but no errors and no alerts.
    I changed the partial view like this:
    <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <div id="chart1" style="min-width: 200px; height: 300px; margin: 0 auto"></div>
    and the master page like this one:
    <ext:Portlet ID="prtPie" runat="server" Title="Pie Test" Icon="ChartPieLightning"  Height="650" >
        <Loader ID="Loader2" runat="server" Url="~/Charts/PieChart" Mode="Html">
            <Listeners>
                <Load Handler="setChart('chart1');" />
            </Listeners>
         </Loader>
    </ext:Portlet>
    why if I use a Panel in the partial view the handler doesn't start?
  6. #6
    Well, because it loads nothing.

    The Load listener does make sense for the Loader which loads something.
  7. #7
    Quote Originally Posted by Daniil View Post
    Well, because it loads nothing.

    The Load listener does make sense for the Loader which loads something.
    I wasn't talking about the listener I mean if in the partial view I've got a simple <div> (or a more complicated html flow) it is rendered correctly bu if I have an Ext.Net Panel it won't
  8. #8
    I am afraid I don't understand the issue well. Could you provide us with a full (but simplified) sample to reproduce the issue?

Similar Threads

  1. [CLOSED] Adding Portlet Dynamically JavaScript
    By peter.campbell in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 04, 2014, 5:52 PM
  2. Replies: 5
    Last Post: Oct 23, 2012, 3:19 PM
  3. Replies: 7
    Last Post: Jul 16, 2010, 12:02 AM
  4. Add Portlet through Javascript
    By sunilaecs in forum 1.x Help
    Replies: 0
    Last Post: Apr 25, 2009, 4:17 AM
  5. Replies: 3
    Last Post: Jan 28, 2009, 6:02 PM

Posting Permissions