cancel
Showing results for 
Search instead for 
Did you mean: 

Fill the content of an iView from a URL

Former Member
0 Kudos

Hi everybody,

I've created an iView (AbstractPortalComponent) with links to different r/3 transactions (the links are generated URL thanks to IIViewUrlGenerator). Therefore when I click the link the transaction is launched in the same iView. What I would like to do it that the transaction is launched in another iView in the same page (target iView). So that the iView containing all the links is still visible (kind of navigation iView).

But I don't know how to do that. I am sure there must be a easy way to set the URL generated by IIViewURLGenerator as the target iView's content. I just know how to communicate between iViews (using EPCF) but I don't see how to set the URL as the target iView's content.

Any idea?

Thanks in advance

Renaud

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Renaud,

See whether this thread helps u in that, try using DoNavigate

Regards

Vinod.

Former Member
0 Kudos

In order to test I created two simple iViews. The first one send the google web page url to the target iView which is therefore supposed to display google's web page.

sender's doContent() :


String myUrl = "http://www.google.fr";
		
response.write("<script language='JavaScript'>");
response.write("EPCM.raiseEvent('namespace', 'myName', '" + myUrl + "');");		
response.write("</script>");

Receiver's doContent() :

response.write("<script language='JavaScript'>");
response.write("EPCM.subscribeEvent('namespace','myEvent', setUrl);");
response.write("function setUrl(evt) {" 
+ "var urlPassed = evt.dataObject;"
+ "document.write(urlPassed);"//just to check the url was passed
+ "var ivID = parent.pageSupport.getIvuId(); "
+ "var myIFrame = parent.pageSupport.getIvuFrameWindow(ivID);"
+ "myIFrame.location.href = urlPassed;"
+ "parent.pageSupport.ivuRefresh(ivID);" 
+ "}");
response.write("</script>");

The URL is correctly passed to the receiver iView but I can't see google's webpage in the target iView. There must be a mistake in my code but I can't see it. Any idea?

Renaud

Former Member
0 Kudos

Hi Renaud,

If u got the url correctly then try this code it will work. Put this in the reciver's doConent()

<script>

function fun()

{

window.location="http://www.google.com"; // give the url here

}

</script>

<body onload=fun()>

</body>

Hope this Helps

gEorgE

Former Member
0 Kudos

Hi George,

thanks this code works but it changes the window's content and not the iView. I need to get the iFrame of the receier iView and set its content with my URL. Unfortunately I can't get propertly the iFrame with my code above..

Renaud

Former Member
0 Kudos

Hi,

The whole window get loaded with the url coz of the property of iView. You have to open the reciver iView properties and set the "Isolation method" to "URL".

This will isolate the iview from the parent page and load the iview with the url only.

Hope this Helps

gEorgE

Former Member
0 Kudos

Hi George,

thanks but unfortunately changing the isolation method to URL did not change anything...

Renaud

Former Member
0 Kudos

I am really stuck... Anyone?

I can't beleive I can't make it working, it should to be a trivial requirement...

Former Member
0 Kudos

Hi Renaud,

My idea, which may have been misunderstood, was to explicitly write

<IFRAME src='your url'></IFRAME>

in your viewing iView.

Yoav.

Former Member
0 Kudos

Hi Renaud,

Why don't you use IsolatedHtmlContainer?

Prakash

Former Member
0 Kudos

Hi Prakash,

I don't know how does that work...

Renaud

Former Member
0 Kudos

Hi Yoav,

thanks a lot it works! But I've got a weird behaviour from my iViews :

This is my code :

Sender

<script>
EPCM.raiseEvent('urn:myOwnNameSpace', 'doNavigateURL', "http://www.yahoo.fr");
</script>

Receiver

<script>
 EPCM.subscribeEvent( 'urn:myOwnNameSpace', 'doNavigateURL', handle_donavigateURL_Event);

 function handle_donavigateURL_Event(evt) {

    var url = evt.dataObject;
    document.write("<IFRAME src=" + url + "></IFRAME>");
 }
</script>

When I launch the page containing the 2 iView the yahoo web page is actually displayed into the sender iView! Why??

Moreover when I click a link in yahoo the link is displayed in the whole page and not in the iFrame anymore.

Renaud

Message was edited by: Renaud Theuillon

Former Member
0 Kudos

Hi Renaud,

Try using right-click->view source on your iViews.

This may offer a hint to the behaviour.

Yoav.

Former Member
0 Kudos

I found out what the problem was, I had to set the isolation mode in the iView properties to "URL" for both iViews. Then the communication with EPCF works fine...

Thanks all for your help.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Renaud,

You can use EPCF for this. On clicking the link on one iview u have to pass the url as parameter. For transfering data u can use client data bag.

Syntax of that is

storeClientData("namespace",key,value);

loadClientData("namespace",key);

You can retrive the url string from the data bag at the target iview and load that iview with that url.

Hope this Helps

gEorgE

Former Member
0 Kudos

Thanks a lot guys. I know how to use EPCF but I would like to know how to actually "load that iview with that url". If you provided me a code snippet for that it would be very nice.

Renaud

Former Member
0 Kudos

Hi renaud,

You can explicitly write an IFRAME tag in your form using myForm.addRawText(), and control the IFRAME src.

If you insist on using two iViews, the "navigation" iView will save the url in the Client Data Bag and raise an event to the "content iView", that will contain the IFRAME tag, snd set its src upon event.

Hope that helps,

Yoav.