[CLOSED] Adding portlets dynamically

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Adding portlets dynamically

    Hi,
    I have a problem creating a new Portlet dynamically and adding it to a PortalColumn.
    While debugging the code I couldn't see any error, so I suppose it could be a caching problem.
    Here is my code:

    <%-- aspx code -->
    <ext:LayoutColumn ColumnWidth="0.7">
                            <ext:Panel runat="server" Border="false" ID="ApplicationsPanel">
                                <Body>
                                    <ext:FitLayout runat="server">
                                        <ext:Portal runat="server" Border="false">
                                            <Body>
                                                <ext:ColumnLayout runat="server">
                                                    <ext:LayoutColumn ColumnWidth=".9">
                                                        <ext:PortalColumn runat="server" StyleSpec="padding:10px 0 10px 10px" ID="ApplicationsPortalColumn">
                                                            <Body>
                                                               <%-- Portlet will be inserted here -->
                                                            </Body>
                                                        </ext:PortalColumn>
                                                    </ext:LayoutColumn>
                                                </ext:ColumnLayout>
                                            </Body>
                                        </ext:Portal>
                                    </ext:FitLayout>
                                </Body>
                            </ext:Panel>
                        </ext:LayoutColumn>
    <%-- aspx.cs code -->
    
    protected void ManageApplications(object sender, AjaxEventArgs e)
        {
            ... some code that retrieves data ...
    
            Portlet p = new Portlet();
            p.Title = "foo";
            this.ApplicationsPortalColumn.Add(p);    
            
        }
    Any help would be appreciated.
    Thanks in advance,
  2. #2

    RE: [CLOSED] Adding portlets dynamically

    GmServizi,

    Check out Vlad's first response under this thread: http://forums.ext.net/showthread.php?5620

    I don't think you can simply add a control to a parent's collection. I haven't messed with all of this yet, but I think you have to either explicitly call a Render method or set the parent controls Render Mode. Lastly, he states that you also need to explicitly specify an ID for the new control to avoid conflicts.

    I hope this helps.

    -MindCore
    Last edited by geoffrey.mcgill; Feb 21, 2011 at 9:53 PM.
  3. #3

    RE: [CLOSED] Adding portlets dynamically

    Hi,

    0.8.2 version doesn't support creating of controls during AjaxEvent
    You have to switch to the 1.0 version (still under development but you can try it, see 'branches' in SVN)
    Vladimir Shcheglov
    Sr. Developer
  4. #4

    RE: [CLOSED] Adding portlets dynamically

    Thank you all.
    I gave a look at the topic you linked, where Vlad suggests to use the Reload() method, but I cannot understand how to call it.

    I changed my code into this:

    <%-- aspx code -->
    <ext:LayoutColumn ColumnWidth="0.7">
                            <ext:Panel runat="server" Border="false" ID="ApplicationsPanel">
                                <Body>
                                    <ext:FitLayout runat="server">
                                        <ext:Portal runat="server" Border="false" ID="AppPortal">
                                            <Body>
                                                <ext:ColumnLayout runat="server">
                                                    <ext:LayoutColumn ColumnWidth=".9">
                                                        <ext:PortalColumn runat="server" StyleSpec="padding:10px 0 10px 10px" ID="ApplicationsPortalColumn">
                                                            <Body>
                                                               <ext:AnchorLayout runat="server" ID="AppAnchorLayout">
                                                               <%-- Portlet will be inserted here -->
                                                               </ext:AnchorLayout>
                                                            </Body>
                                                        </ext:PortalColumn>
                                                    </ext:LayoutColumn>
                                                </ext:ColumnLayout>
                                            </Body>
                                        </ext:Portal>
                                    </ext:FitLayout>
                                </Body>
                            </ext:Panel>
                        </ext:LayoutColumn>
    <%-- aspx.cs code -->
    protected void ManageApplications(object sender, AjaxEventArgs e)
        {
            ... some code that retrieves data ...
    
            Portlet p = new Portlet();
            Anchor a = new Anchor();
            
            p.Title = "foo";
            a.Items.Add(p);
            this.AppAnchorLayout.Anchors.Add(a);
    
            //here it should go the Render call, but this.AppPortal.Render(); rises an exception
    
            this.ApplicationsPanel.DoLayout(); 
            
        }
    Is this the right way to dynamically create a Portlet object inside an Anchor?
    Where do I need to explicitly specify new IDs?

    Thanks in advance,
  5. #5

    RE: [CLOSED] Adding portlets dynamically

    Hi,

    As I said in previous post the 0.8.2 doesn't support controls creation during AjaxEvent.
    Do you try to add portlets during AjaxEvent? Are you using 0.8.2 version?
    Vladimir Shcheglov
    Sr. Developer
  6. #6

    RE: [CLOSED] Adding portlets dynamically

    Hi Vlad,
    yes, I am trying to add portlets during AjaxEvent and I am using the 0.8.1 version.
    Can I resolve this if I update to the 1.0 version?
    Thanks,
  7. #7

    RE: [CLOSED] Adding portlets dynamically

    Hi,

    Yes, 1.0 version is supported it. Please note that 1.0 version under development and some things can be unstable or changed in the final release
    Vladimir Shcheglov
    Sr. Developer
  8. #8
    Quote Originally Posted by Vladimir View Post
    Hi,

    Yes, 1.0 version is supported it. Please note that 1.0 version under development and some things can be unstable or changed in the final release
    Is there any way to rearanging Portlets in Portal Columns dynamicaly on client side ?
    For example.
     var prt = Ext.getCmp('portlet1'); //first takes the portlet from Portal Column1
    Ext.getCmp('PortalColumn1').removeAll(); clears all Portlet
    Ext.getCmp('PortalColumn2').add(prt)// this does not work
    Ext.getCmp('PortalColumn2').items.add(prt)// this is also is not working
    So how should I proceed to dynamicaly rearange the portelts ??
  9. #9
    Hi,

    Is the "portlet1" initially in the "PortalColumn1", right?

    If yes, then, I guess, it destroys this portlet.
    Ext.getCmp('PortalColumn1').removeAll(); clears all Portlet
    Please try this:
    var prt = Ext.getCmp('portlet1');
    
    Ext.getCmp('PortalColumn2').add(prt);
  10. #10
    Quote Originally Posted by Daniil View Post
    Hi,

    Is the "portlet1" initially in the "PortalColumn1", right?

    If yes, then, I guess, it destroys this portlet.
    Ext.getCmp('PortalColumn1').removeAll(); clears all Portlet
    Please try this:
    var prt = Ext.getCmp('portlet1');
    
    Ext.getCmp('PortalColumn2').add(prt);
    Thanks Daniil for quick reply. No unfortunately it did not work it has no effect on adding portlet to PortlalColumn.
    For example here https://examples1.ext.net/Examples/Portal/Basic/Deluxe/
    Try to run the code on firebug console it has no effect
    var  prt = Ext.getCmp('Portlet2')
    Ext.getCmp('ctl21').add(prt)
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] Dynamically adding view to panel MVC
    By RCM in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Oct 14, 2011, 7:19 PM
  2. [CLOSED] Adding UserControl dynamically in code-behind
    By wagger in forum 1.x Legacy Premium Help
    Replies: 24
    Last Post: May 17, 2011, 10:48 PM
  3. [CLOSED] adding listitems dynamically in a combobox
    By LeeTheGreek in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Dec 22, 2009, 5:26 PM
  4. adding tabs dynamically
    By n_s_adhikari@rediffmail.com in forum 1.x Help
    Replies: 3
    Last Post: Nov 16, 2009, 8:29 AM
  5. [CLOSED] Dynamically adding controls to a tav
    By riccardosarti in forum 1.x Help
    Replies: 3
    Last Post: Sep 24, 2008, 10:49 AM

Posting Permissions