What does your newvalue.load view look like? Does it display the temp and 
timet lists?

Note, your index.html view is incorrect -- it has {{=temp}} and {{=timet}}, 
but the dictionary returned by the index() function instead uses VA and VB 
as keys, so the view should have {{=VA}} and {{=VB}} (should be the same in 
your newvalue.load view). Actually, because the returned values are Python 
lists, you probably want a more sophisticated display than simply {{=VA}}.

Also, note that there is no reason to have two identical functions. You can 
instead have a single function and just use two different views and 
extensions (i.e., index.html and index.load).

Even better, just use an Ajax component to load the data and set it to 
refresh periodically:

def index():
    return dict()

def get_data():
    ...
    return dict(VA=temp, VB=timet)

In views/default/index.html:

{{=LOAD('default', 'get_data.load', ajax=True, timeout=1000, times=
'infinity')}}

In views/default/get_data.load:

{{=VA}}
{{=VB}}

Keep in mind that this is an inefficient way to get realtime updates. 
First, you are polling every second, whether or not the data have changed. 
Second, you are sending all the data on every request instead of just the 
changes. This may be fine for your use case, but a more efficient approach 
would be to use a server push pubsub method (e.g., use websockets to 
publish updates to the client) -- see 
https://github.com/web2py/web2py/blob/master/gluon/contrib/websocket_messaging.py.

Anthony


On Friday, September 8, 2017 at 2:52:57 AM UTC-4, Wabbajack wrote:
>
> Hi All,
>
>
>
> I am really confused on auto updating variable on view...
> What i want is i have an initial value that is displayed on 
> index.html<view> thru query in default.py index function
> But hope to change this values everytime there is a change on the database.
>
> I have read this 
> https://groups.google.com/forum/#!topic/web2py/XN9Wqb3jqKk
> but still having confusion the variable arent updating or creating new 
> string file
>
>
> *controllers/default.py
>
>
> *view/default/index.html
>
>
>
> * Also i have created a file newvalue.load on views/default/ directory
>
>
> *models.py
>
>
> <additional info>
> I am using web2py 2.14 on windows PC
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to