On Thursday, March 10, 2016 at 9:35:08 AM UTC-5, Ron Chatterjee wrote:
>
> I was going to call the pagination from multiple controller. I have about 
> 10 of them use pagination and tired of keep typing up the same over and 
> over again and clutter the page. Okay...so, these what I understood so far:
>
> (1) I can make a call to pagination from multiple controller inside 
> default.py if I have pagination function defined in model. 
>

To be clear, in web2py a "controller" is a .py file in the /controllers 
folder, and it may contain multiple *actions* (actions are functions in the 
controller). When you say "multiple controller inside default.py," 
presumably you mean multiple actions in the default.py controller.

In any case, if you only need the pagination function for actions within 
the default.py controller, then you may define the function there, as it is 
only needed in that one controller. However, as noted, if you define a 
helper function in a controller that is not intended to be an action 
accessible via URL, you must precede its name with a double underscore or 
otherwise make sure it accepts at least one argument.
 

> (3) I can make a call to pagination from multiple controller inside 
> default.py if I have pagination function defined in controller (default.py) 
> but in that case I have to use URL redirect. And in URL redirect I can pass 
> arguments.
>

No. First, as noted above, you can define pagination inside default.py and 
call it from within there. Also, you are confusing the calling a Python 
function with making an HTTP request to a URL (which ultimately results in 
a function being executed). In this case, you do not want to do a redirect 
(which tells the browser to make an HTTP request to an alternative URL) nor 
use LOAD (which generates an Ajax component that makes an Ajax request to a 
particular URL). Rather, you simply want to create and call a standard 
Python function that accepts some inputs and generates some outputs that 
you can then use for pagination purposes.
 
Anthony

-- 
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