How to clear a list in a view with jquery

23 views
Skip to first unread message

mostwanted

unread,
Jun 6, 2020, 6:13:12 PM6/6/20
to web2py-users
Guys is it possible to clear a list in a view using jquery?
Something like this:

CODE EXAMPLE:
{{if details:}}
{{for details in details:}}

{{=details.first_name}}
{{=details.last_name}}
{{pass}}

<script>
$
(function()
{
$
('#close').click(function(e)
{
{{details.clear()}};
});
});
</script>


How can I achieve this because?

Regards;

Mostwanted

António Ramos

unread,
Jun 7, 2020, 6:25:28 PM6/7/20
to web...@googlegroups.com
i guess you mean 
{{for detail in details:}} 
instead of 
{{for details in details:}} 

anyway 
the python code is rendered in server before being sent to the view. so your script cant change any of your python code output
You could use the ajax function to update a div content or better vuejs or other frontend framework...

Ramos

--
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 web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/9831eef9-75ec-4c58-b86b-92f97d59e510o%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages