You need to sign in to do that
Don't have an account?
Naresh Krishna.ax1176
How to open the window in new tab for each onclick ?
Hi All,
I am using below piece of code to open the window in new tab:
<apex:dataList value="{!displayWindows}" var="window">
<apex:commandLink style="text-decoration:none" action="{!openwindow}" target="__blank{!window.windowId}" >
{!window.windowName}
</apex:commandLin>
</apex:dataList >
Its not working completly.
When i click on commandLink first time, it opens in new tab.
But i click on again, it refreshes the previously opened tab but not opened in new tab.
Can anyone please help me with this.
Thanks.
can u plz share u r apex code 2 so i can understand about this {!window} paramter
it may be a case the the new page that is open the code of command link mit get chage u can look into it's sorce code to find out the difference b/w link in main window & the newly open window
On brief, code is as follows:-
List<WindowVO> windows = new List<WindowVO>();
WindowVO vo1 = new WindowV();
vo1.setWindowId('1');
vo1.setWindowName('window1');
windows.add(vo1);
WindowVO vo2 = new WindowV();
vo2.setWindowId('2');
vo2.setWindowName('window2');
windows.add(vo2);
Thanks.
In Place of using <apex:commandLink> you can use <a her></a>
for look into the ref code to replicate u r case i create a wrapper class with name as WindowVO
Apex Class
public class commhelp1
{
public PageReference p1{get;set;}
public list<WindowVO> displayWindows{get;set;}
public commhelp1()
{
p1 = null;
displayWindows = new list<WindowVO>();
WindowVO vo1 = new WindowVO();
vo1.WindowId = '1';
vo1.WindowName = 'window1';
displayWindows.add(vo1);
WindowVO vo2 = new WindowVO();
vo2.WindowId = '2';
vo2.WindowName = 'window2';
displayWindows.add(vo2);
}
public class WindowVO
{
public String WindowId{get;set;}
public String WindowName{get;set;}
}
public PageReference openwindow()
{
p1=new PageReference('/apex/commhelpPage1');
return p1;
}
}
Page
<apex:page controller = "commhelp1" cache="false">
<apex:form>
<apex:dataList value="{!displayWindows}" var="window">
<a href="{!p1}" target="_blank"> {!window.windowName} </A>
</apex:dataList >
</apex:form>
</apex:page>
If u havw any query u can replay me back
Thanks & Regards
SRK