You need to sign in to do that
Don't have an account?
nickwick76
Why does target work different for different link types in an inline VF-page?
I have created a Visualforce page with a pageblock table and a couple of columns. The first column contains a apex:commandlink element.
I put this VF-page as an inline VF-element in a page layout. Clicking the link will open the page in the iframe. It doesn't matter what I put in the 'target' attribute (_top, _blank etc.).
If I create a HTML link above the table in the same VF-page the target attribute works, i.e. the new page opens in the whole window or a new window.
So this code works:
<a href="http://www.salesforce.com" target="_top">test</a>
But this does not:
<apex:form > <apex:outputPanel id="mainOppNotes"> <apex:pageBlock title="Notes" mode="maindetail"> <apex:pageBlockTable value="{!MainOppNotes}" var="n"> <apex:column headerValue="Action" width="5%"> <apex:commandLink action="{!viewNote}" id="viewNote" rerender="mainOppNotes" value="View" styleClass="actionLink" target="_blank"> <apex:param name="noteId" assignTo="{!noteId}" value="{!n.Id}" /> </apex:commandLink> </apex:column> <apex:column headerValue="Name" width="65%">{!n.Title}</apex:column> <apex:column headerValue="Last Modified" width="30%"><apex:outputtext value="{!n.LastModifiedByName}" />, <apex:outputtext value="{!n.LastModifiedDateStr}" /></apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:outputPanel> </apex:form >
Can I affect this in any way? Why does it work like this?
// Niklas
Bob,
I tested further with your approach and it works now!
I have modified the VF-code to this:
And then added a refreshPage class variable with getter and setter which defaults to false in the constructor and is set to true with the new param tag as you can see above:
Thanks a lot Bob for your help!
// Niklas
All Answers
I wrote a blog post on refreshing the containing page from an embedded visualforce page - is this any help:
http://bobbuzzard.blogspot.com/2011/05/refreshing-record-detail-from-embedded.html
Hi Bob,
Thanks for your reply and sorry for my late reply.
I had to go for another solution since time was not no my side.
I gave your suggestion a try but it didn't work out for me. Maybe with some more effort it will work out. Thanks anyway!
BR / Niklas
Hai
you are using the property rerender in command link then vf thinks it is new page.thats why the link is opening in a same page. Replace action with onClick()="window.open('{!your_method}')". then it will works.
Hi Suresh,
I didn't get that to work.
onClick="window.open('{!viewNote}')"
gives me the error message "Unknown property 'OpportunityStandardController.viewNote"
Your suggestion with parenthesis:
onClick()="window.open('{!viewNote}')"
gives me the error message "Attribute name 'onClick' associated with an element type "apex:commandLink" must be followed by the '=' character.
Bob,
I tested further with your approach and it works now!
I have modified the VF-code to this:
And then added a refreshPage class variable with getter and setter which defaults to false in the constructor and is set to true with the new param tag as you can see above:
Thanks a lot Bob for your help!
// Niklas
hi
Glad to see you got there.