PDA

View Full Version : Webview refresh / reload



murali_mepath
2013-12-17, 10:57
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)


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)


<%@ 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>

hmischel@diligentsystems.com
2013-12-17, 13:58
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

murali_mepath
2013-12-17, 20:16
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