There are two types of frameworks push and pull.

In a push framework (like web2py, Django, Rails) the URL is mapped
into a function, which returns data (in the form of a dictionary) and
the data is rendered by one view.

In a pull framework (like Struts and JBoss) the URL is mapped into a
view which calls one or more controller functions.

>From your question I assume you have a pull framework in mind. You can
mimic a pull framework in web2py in multiple ways. One way is via ajax
requests:

#controller default.py
def index(): return dict()
def f1(): return response.render('partial_view1.html',dict())
def f2(): return response.render('partial_view2.html',dict())

#view default/index.html
{{extend 'alyout.html'}}
<div id="f1"></div>
<div id="f2"></div>
<script>
jQuery(document).ready(funciton(){
  ajax('{{=URL(f='f1')}}",[],'f1');
  ajax('{{=URL(f='f2')}}",[],'f2');
})};
</script>

#view partial_view1.html
Hello

#view partial_view2.html
World


Hope it makes sense.

Massimo


On Aug 11, 8:50 am, Don <sam...@gmail.com> wrote:
> I am new to the MVC paradigm, python, and web2py.  I would like to be
> able to:
>
> 1. create a controller (done)
> 1. define a series of functions (including index)
> 2. call any of the function from a single view.
>
> Example.  I have a model that consists of three tables.  My default.py
> controllers index function returns a dictionary containing rows from a
> query about vendor names.  I build a table with the vendor names.  I
> also want to build a subtable listing the products available from each
> vendor.  For that I would like to define another function that takes
> the vendor id and returns products related to that vendor id.  But I
> would have to make another view (if I understand correctly).
>
> I want all the information to appear in a single view.  Is this
> possible?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to