Apr 25, 2009, 3:17 AM
Add Portlet through Javascript
I want to add a portlet which forms like igoogle widget. So i want to add widget dynamically by calling a javascript function. SO i tried to acomplish it in this way.
Javascript function
Javascript function
<script type="text/javascript" language="javascript">
function AddWidget()
{
document.getElementById("PortalColumn2").lastChild.appendChild(document.getElementById("PortalColumn2").firstChild.cloneNode(true));
}
</script>
ASP.Net Controls Code Page
<ext:LayoutColumn ColumnWidth=".33">
<ext:PortalColumn
ID="PortalColumn2"
runat="server"
StyleSpec="padding:10px 0 10px 10px">
<Body>
<ext:AnchorLayout ID="AnchorLayout2" runat="server">
<ext:Anchor>
<ext:Portlet Title="Panel 2" Height = "300" runat="server" >
<AutoLoad Url="http://www.wikipedia.org/" Mode="IFrame"/>
</ext:Portlet>
</ext:Anchor>
<ext:Anchor>
<ext:Portlet ID="Portlet3" Title="Another Panel 2" runat="server" >
</ext:Portlet>
</ext:Anchor>
</ext:AnchorLayout>
</Body>
</ext:PortalColumn>
</ext:LayoutColumn>
The thing is i could not achieve to add portlet this way. The look is crippled and as i refreshed the page the widgets go away. So please provide the solution if any body found the way out.