Hi
After testing, and getting the data to load Via
{{=LOAD('default','test.load',ajax=True)}}
When loading the page I get the updated results as required, but it says in
the doc Web2py Doc
<http://web2py.com/books/default/chapter/29/12/components-and-plugins>,
that "The DIV content is refreshed without reloading the rest of the page."
But if I update data from a different page or on the same page the data
does not update, without a refresh.
Controller.
def test():
IT1 = 'IT1'
rows = db((db.pupils.upn_no==db.register.upn_no)&(db.register.room ==
IT1)& (db.register.date == request.now.date())).select()
return dict(rows=rows)
def load():
return dict()
View test.load
<Div><table>
<tr><th>First
Name</th><th>Surname</th><th>Room</th><th>Period</th><th>Date</th><th>Year</th><th>Form</th></tr>
{{for row in rows:}}
<tr><td>{{=row.pupils.first_name}}</td><td>{{=row.pupils.surname}}</td><td>{{=row.register.room}}</td><td>{{=row.register.period}}</td><td>{{=row.register.date}}</td><td>{{=row.pupils.year}}</td><td>{{=row.pupils.form}}</td></tr>
{{pass}}
</table></div>
View load.html
{{extend 'layout.html'}}
{{=LOAD('default','test.load',ajax=True)}}
I have another page which updates the page, but I also added the code
{{=LOAD('default','test.load',ajax=True)}}
onto the page to see if it would update the div while it was updating, it
only updates on refresh.
Thanks.
On Tuesday, 24 March 2015 01:59:09 UTC, Dave S wrote:
>
>
>
> On Monday, March 23, 2015 at 6:44:15 PM UTC-7, Dave S wrote:
>>
>> [...]
>>
> Looking again at
>> <URL:
>> http://www.web2py.com/books/default/chapter/29/12/components-and-plugins?search=LOAD%28%29#LOAD
>> >,
>> it seems the example DOESN'T have a pre-existing DIV. To clean up my
>> code, I need to do the 'contents=' parameter with the spinner as well as
>> the text.
>>
>> (The "jsoffs " stuff should be able to be moved into the outer
>> environment (good ol' "span12"), because it can lay around hidden forever
>> and ever.)
>>
>> Side note: In FF, "Show Source" always shows the pre-load version.
>> "Inspect Element" shows the updated contents. This might help some later
>> reader.
>>
>>>
>>>>
> This seems to be a working correction:
>
>
>
> <br>
> {{loadmsg = CAT("loading ...", BR(), SPAN(_class="fa fa-spinner
> fa-spin"))}}
> {{=LOAD(c='thats', f='thats2.load', target='my_hats', content=loadmsg,
> ajax=True)}}
>
>
>
>
--
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.