Results 1 to 3 of 3

Thread: Webview refresh / reload

  1. #1
    Member
    Join Date
    Nov 2013
    Posts
    77

    Unhappy Webview refresh / reload

    hi,

    I have a webview section (with Javascript as the Scripting Language). I have this simple HTML code to change the colors of the page a few times. I have another custom gadget (scripting language python). I was trying to reload the page on a button click. But it just doesn't refresh/reload. Any clues please? Moreover what would be the best way to load html / url in the webview gadget?

    Python Custom Gadget Code (Button click does not reload the page)
    Code:
    import Lianja
    
    class RefButton(Lianja.Commandbutton):      
        def click(self):
    		oitem = Lianja.getElementByID("section1")
    		oitem.reload
    
    mygadget = Lianja.createObject("oGadget", "Gadget")
    mygadget.addobject("refbutton", "RefButton")
    refbutton.caption = "Refresh"
    returnvalue = mygadget
    Webview Code (No issues with this)
    Code:
    <%@ Language=JavaScript %>
    <HTML> 
    <HEAD> 
    <SCRIPT LANGUAGE="JavaScript"> 
    	var intPgColorIndex = 0; 
    	var arrPgColor = new Array("#4048BA", "#E9F23E", "#F73BA9", "#51F73B", "#48F8FB"); 
    	var clock;
    
    	function StAnim()	{ 
      		var PgColor; 
      		if (intPgColorIndex >= arrPgColor.length) 
    		  	{ 
    				ClearTimeout(clock);
    				intPgColorIndex = 0;
    			} 
    else
    			{
      				PgColor = arrPgColor[intPgColorIndex]; 
      				document.body.style.backgroundColor = PgColor; 
    				intPgColorIndex++; 		  
    				clock=setTimeout("StAnim()",1000);
    			}
    	} 
    </SCRIPT> 
    </HEAD> 
    <BODY ONLOAD="StAnim()"> 
    </BODY>
    </HTML>

  2. #2
    Senior Member
    Join Date
    Feb 2012
    Posts
    1,237
    Hi Murali,

    I use web views slightly different than you are using them.

    1. I save my HTML pages in the library as .rsp pages.
    2. I don't use webview sections, but rather Form sections with webview gadgets in them.

    I cant say if this is right or wrong, just what works for me.

    In your case, I was not able to refresh the URL with reload or refresh in webview section, but I was able to do it by re-setting the URL in a webview gadget.

    I took your code and saved it in the library as webcolor.rsp

    web1 = lianja.get("page1.section2.wvGadget")
    wvGadget.url ="lib:/webcolor.rsp"

    Each time I run the
    wvGadget.url ="lib:/webcolor.rsp"
    The colors change.


    Like I said, a work around for now.

    Herb

  3. #3
    Member
    Join Date
    Nov 2013
    Posts
    77
    hi Herb,

    That's cool. Thanks a lot for the workaround. As long as the workaround works predictably I am ok implementing it :-D

    Just getting a hang of the behaviours of the various sections/gadgets. But I am really glad that there is one tool that lets me bring together some very fantastic, useful technologies like HTML5,CSS, Javascript and..............python! :-)

    Cheers,
    Murali

Tags for this Thread

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us