Page 1 of 2

How to refresh html component

Posted: Wed Oct 22, 2014 2:55 pm
by David wyatt

Hi,

i have a html component that i need to refresh on a button click. i set this event

Appery("html_comp").html("refresh");

but it justs changes html component to the word refresh

thanks


How to refresh html component

Posted: Wed Oct 22, 2014 4:44 pm
by Kateryna Grynko

Hi David,

Method codehtml/code replaces a component content that is why all you see is 'refresh'.

What is stored in your HTML component that you want to refresh?


How to refresh html component

Posted: Wed Oct 22, 2014 4:49 pm
by David wyatt

Hi,
it's a javscript graph generated by inputs from the app, so I need it to refresh every time new data is inputted.


How to refresh html component

Posted: Wed Oct 22, 2014 6:13 pm
by Kateryna Grynko

Hi David,

What library do you use to build graph? It should have its own method to refresh after adding data.


How to refresh html component

Posted: Wed Oct 22, 2014 6:20 pm
by David wyatt

It's plotted directly from JavaScript on canvas and doesn't use a library afraid.


How to refresh html component

Posted: Wed Oct 22, 2014 6:40 pm
by Evgene Karachevtsev

Hello David,

Html component doesn't have opportunity to restart, only insert inside new html code of, for example, your updated graphics.


How to refresh html component

Posted: Wed Oct 22, 2014 7:08 pm
by David wyatt

How would I insert new code, as I was thinking I could keep a copy of the code I need and continely insert it to refresh the variables?


How to refresh html component

Posted: Thu Oct 23, 2014 6:05 am
by Evgene Karachevtsev

David,

Could you please share your project with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a, tell us its name and steps to reproduce the issue with graphic? http://devcenter.appery.io/documentat...


How to refresh html component

Posted: Thu Oct 23, 2014 7:50 am
by David wyatt

Hi,

thank you for your help.
ive shared the app, its called xappy. i need the html component to refresh when you press the refresh button. ive tried to use
Appery("xappy_html").html("") with the contents of my html component in it so that it replaces it with the same script as before (that way it appears to refresh). But as the script is multiple lines it keeps failing. hope that makes sense


How to refresh html component

Posted: Thu Oct 23, 2014 9:46 am
by Evgene Karachevtsev

David,

In html component you should have only the canvas tag, all js code please put in a separate file and wrap it in a function.
Everything else delete. When clicking call a function that will work and will update canvas.