[web2py] Re: Pagination, only add var if it already exists?

2017-03-30 Thread r
My code for the pagination (next button) Next If there is a name, it will add it to the url however if there is no name, it will add "none". Instead if it doesn't exist I don't want it to add anything, just the page. On Thursday, 30 March 2017 16:34:28 UTC+1, Anthony wrote: > > It is not quit

[web2py] Re: Pagination, only add var if it already exists?

2017-03-30 Thread Anthony
It is not quite clear what you are asking. Please show some code. Anthony On Thursday, March 30, 2017 at 10:41:50 AM UTC-4, r wrote: > > Hi, so my index page is like this: /index?page=1 I'm using pagination, > when the user clicks on the next page, it should become: /index?page=2 > > However if

Re: [web2py] Re: pagination issue redirecting to the current page

2015-01-06 Thread Joe
Michele, Thanks so much for this. I tried to remove the select action and change the view as suggested but that wasn't working. So, I experimented with the redirect from the select action to the index a couple of times. I removed the request.vars.id, from the redirect and now it's working! The

Re: [web2py] Re: pagination issue redirecting to the current page

2015-01-04 Thread Michele Comitini
Joe, If you stay on page 1, it's because you do not pass the args parameter correctly, when doing the redirect. check you pass the variable page to the select() function and also that when you redirect back to index you pass correctly the page as request.args(0) also simplify your code by removin

[web2py] Re: pagination issue redirecting to the current page

2015-01-03 Thread Joe
Hi Michele, thanks so much for looking at this problem. I appreciate it very much. I tried the code but after selecting, the user is still sent back to page 1 each time, not staying on the same page. On Friday, January 2, 2015 10:18:44 PM UTC+8, Michele Comitini wrote: > > in the view links add

[web2py] Re: pagination issue redirecting to the current page

2015-01-02 Thread Michele Comitini
in the view links add the page and element id: {{=A('Select', _id = i.id, _class="btn btn-danger",_href=URL("select", args= i.id, vars=dict(id=i.id,page=page)))}} {{elif i.selected:}} {{=A('Selected', _id = i.id, _class="btn btn-info",_href=URL("select", args= i.id, vars=dict(id=i.id, page=page <

[web2py] Re: Pagination within a SQLFORM.factory

2014-11-28 Thread Anthony
The grid allows you to implement a custom search widget (via the "search_widget" argument) as well as a custom server-side search function (via the "searchable" argument) to build a query based on the keywords returned by the widget. This isn't well documented, so you'll have to look at the sou

[web2py] Re: pagination issue redirecting to the current page

2014-11-21 Thread Joe
@Massimo, Thanks very much Massimo. I am trying to find a way to redirect the user to the page where the user clicks on the select button to select an item. The user might be on page 2 or page 3 page 4 or any other page when he selects the item. How can I redirect the user to the same page he i

[web2py] Re: pagination issue redirecting to the current page

2014-11-19 Thread Massimo Di Pierro
URL('index',args=(2)) will give you page #2. On Monday, 17 November 2014 22:59:16 UTC-6, Joe wrote: > > Thanks Cliff, I've been trying to do that but I didn't succeed. I would > appreciate if you could send an example on how to put the current page info > in the request.args dictionary. > > On

[web2py] Re: pagination issue redirecting to the current page

2014-11-19 Thread Joe
Thanks Cliff, I've been trying to do that but I didn't succeed. I would appreciate if you could send an example on how to put the current page info in the request.args dictionary. On Tuesday, November 18, 2014 12:37:09 PM UTC+8, Cliff Kachinske wrote: > > Put information about the current page i

[web2py] Re: pagination issue redirecting to the current page

2014-11-17 Thread Cliff Kachinske
Put information about the current page in the request.args dictionary. You could use the session, but if your user opens a second browser window it becomes difficult to keep track of which session data corresponds to which browser tab. On Friday, November 14, 2014 8:37:25 PM UTC-5, Joe wrote: >

[web2py] Re: Pagination with two queries

2014-05-02 Thread Anthony
If the provinces are mutually exclusive (is that the case), of course there won't be any records that match both of them. Do you perhaps want to use "||" instead? On Friday, May 2, 2014 7:01:02 AM UTC-4, Ruud Schroen wrote: > > I tried that, it returns zero results.. > > Also when i print the qu

[web2py] Re: Pagination with two queries

2014-05-02 Thread Ruud Schroen
I tried that, it returns zero results.. Also when i print the query, this comes out: ((kamernet.province = 'Limburg') AND (kamernet.province = 'North Brabant')) > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - ht

[web2py] Re: Pagination with two queries

2014-05-02 Thread 黄祥
please try (not tested): query = (db.kamernet.province == 'Limburg') & (db.kamernet.province == 'North Brabant') best regards, stifan On Friday, May 2, 2014 5:45:15 PM UTC+7, Ruud Schroen wrote: > > Hi, > > I'm trying to use the pagination from web2py_utils with two queries. > Usually the code

[web2py] Re: Pagination example from book. Make pages start at 1?

2014-02-18 Thread Derek
Well, this is really trivial isn't it? On Tuesday, February 18, 2014 3:18:14 PM UTC-7, HittingSmoke wrote: > > I followed the pagination tutorial in the web2py book and I have the > following controller: > > def index(): > if len(request.args): page=int(request.args[0]) > else: page=1 >

[web2py] Re: pagination with web2py

2012-10-08 Thread martzi
I suggest you download a copy of the web2py manual (http://web2py.com/book). Read and run the snippet on pagination. with a some tweaks you could as well achieve an infinite scroll pagination. On Thursday, October 4, 2012 4:16:00 PM UTC+2, Paulo Donizeti Gardinalli Filho wrote: > > hi, I am sta

[web2py] Re: pagination with web2py

2012-10-04 Thread Massimo Di Pierro
grid = SQLFORM.grid(query) {{=grid}} will display the records with pagination. On Thursday, 4 October 2012 09:16:00 UTC-5, Paulo Donizeti Gardinalli Filho wrote: > > hi, I am starting to use web2py and I am very impressive with his > facilities. I am a visualy empaired user and this framework

[web2py] Re: Pagination with no database

2012-07-23 Thread Niphlod
Usually you have some means to "order" the records (e.g., a "id" field that is 1,2,3,4,5, a "name" field that is a,b,c,d, an inserted_on datetime field that is 2012-07-23m, 2012-07-24, etc etc etc). When the order of the records is established in a list: all_records = ['a','b','c','d',...]

[web2py] Re: Pagination with no database

2012-07-23 Thread adohertyd
Thank you for that makes perfect sense. This might be a stupid question but do I need to create an individual HTML page for each result set? The whole pagination thing is a mystery to me! On Monday, 23 July 2012 21:33:34 UTC+1, Niphlod wrote: > > That's math! > e.g. > records_per_page = 10 recor

[web2py] Re: Pagination with no database

2012-07-23 Thread Niphlod
That's math! e.g. records_per_page = 10 records all_records = 137 records pages_needed = all_records / records_per_page (division) last_page = all_records % records_per_page (module) that is 13 "full pages" + 1 page with 7 records. So, you'll have to count the total of your records, divide it by

[web2py] Re: Pagination issue in GAE using web2py

2012-01-12 Thread howesc
to play this game on GAE: - consider de-normalizing the data and storing a list of activities on each user record. - get the data from table X, then do a query on table Y like: "db(db.Y.id.belongs(keys).select()" where keys is a list of IDs from the first query. remember that GAE limits belo

[web2py] Re: Pagination issue in GAE using web2py

2012-01-12 Thread Massimo Di Pierro
SQLFORM.grid does pagination On Jan 12, 8:53 am, Saurabh S wrote: > Hi, > > I am developing an online booking application in python using web2py > framework on google app engine. > > I have  two tables, one is users table and other is activities table. > My users table contains user id for each r

[web2py] Re: Pagination

2011-08-06 Thread Massimo Di Pierro
You can put anywhere you like. If it goes in a module, you need to import it. Because of the new custom import and current. This is no longer a problem. Any module imported by a model or controller can do from gluon import current, DIV, SQLHTML, etc. and get access to everything. current contains

[web2py] Re: Pagination

2011-08-06 Thread pbreit
Where does the class go? In a module? I still don't fully understand "current". Is that an easy way for a module to have access to the whole current environment?

[web2py] Re: Pagination

2011-08-06 Thread Massimo Di Pierro
You can do something like this: class Paginator(DIV): items_per_page = 10 records = 100 def limitby(self): from gluon import current page = self.page=int(current.request.vars.page or 0) return (self.items_per_page*page,self.items_per_page*(page +1))

[web2py] Re: Pagination

2011-07-15 Thread Anthony
Have you seen this section in the book: http://web2py.com/book/default/chapter/12#Pagination? The PowerTable plugin uses DataTables, which allows server-side processing, including pagination. jqGrid also allows server-side pagination. Anthony On Friday, July 15, 2011 1:32:53 PM UTC-4, Gilson

Re: [web2py] Re: pagination previous and next on the controller

2011-05-15 Thread Stifan Kristi
thank you so much for your hints and pointers, pbreit. i've already read the url, but still don't understand, what is the intent of the url. but i get it what you've said, again thank you very much. On Mon, May 16, 2011 at 12:44 AM, pbreit wrote: > You could check out this approach: > http://pac

Re: [web2py] Re: pagination previous and next on the controller

2011-05-15 Thread pbreit
You could check out this approach: http://packages.python.org/web2py_utils/paginate.html {{ }} *ONLY* work in views. The other thing you could consider if you want to put it in a controller, model or module is using HTML tag helpers like this: if page: previous = A('previous', _href=UR

Re: [web2py] Re: pagination previous and next on the controller

2011-05-15 Thread Stifan Kristi
i've already tried to moved curly brackets {{ }} in the controllers and still gettin an error, my intention is because all of my views is using pagination and i want to simplified it to just put on the centralize db functions. is there any ways to do this? thank you so much On Sun, May 15, 2011 at

[web2py] Re: pagination previous and next on the controller

2011-05-14 Thread pbreit
You don't put {{ and }} in controllers. Just do it like it is in the book. HTML typically belongs in the view.

[web2py] Re: Pagination in web2py

2011-04-12 Thread David Marko
Hello, see web2py util project here: http://packages.python.org/web2py_utils/paginate.html I have a good experinece with this. For more advanced solutions you an use this: http://www.web2pyslices.com/main/slices/take_slice/39 David

[web2py] Re: Pagination in web2py

2011-04-12 Thread Francisco Costa
The thing is that I use paginations on a lot of different controllers, and I would love to have a more generic solution On Apr 12, 11:29 am, Tom Atkins wrote: > This worked for me: > > http://www.web2py.com/book/default/chapter/12#Pagination > > On 12 April 2011 11:16, Francisco Costa wrote: >

Re: [web2py] Re: Pagination [Web2py Utils] returns None

2010-11-12 Thread Thadeus Burgess
Thanks. I uploaded a new version to pypi. -- Thadeus On Fri, Nov 12, 2010 at 10:27 AM, Andrew Evans wrote: > Hey Thadeus! > > where would you like me to submit it? I can upload it here to this news > group. The only thing I changed was what you suggested ;) adding self.r.args > to the genera

Re: [web2py] Re: Pagination [Web2py Utils] returns None

2010-11-12 Thread Andrew Evans
Hey Thadeus! where would you like me to submit it? I can upload it here to this news group. The only thing I changed was what you suggested ;) adding self.r.args to the generate links function ;) def generate_links(self): self.backward = A('<< previous()', _href=URL(r=self.r, args=self.r

Re: [web2py] Re: Pagination [Web2py Utils] returns None

2010-11-11 Thread Thadeus Burgess
Mind sending me a patch? -- Thadeus On Thu, Nov 11, 2010 at 6:02 PM, Andrew Evans wrote: > hey thanks for the tips > > I have it working now > > *cheers > > Andrew >

Re: [web2py] Re: Pagination [Web2py Utils] returns None

2010-11-11 Thread Andrew Evans
hey thanks for the tips I have it working now *cheers Andrew

Re: [web2py] Re: Pagination [Web2py Utils] returns None

2010-11-11 Thread Thadeus Burgess
There are two alternatives. Have the generate_links function assume args when creating the url. This could be based on the existing args in request. URL(r=self.r, args=self.r.args) Or patch get_set to allow passing args as part of the function declaration, it would in turn pass these args to the

Re: [web2py] Re: Pagination [Web2py Utils] returns None

2010-11-11 Thread Andrew Evans
Hello ty for the reply You wouldn't by chance be able to help me with a patch. Your talking about the paginate.py file to patch set_links in there or with in the set_links value in my code? Your the developer of Web2py Utils is that correct? Nice work on it :D *cheers Andrew On Wed, Nov 10,

Re: [web2py] Re: Pagination [Web2py Utils] returns None

2010-11-10 Thread Thadeus Burgess
Its losing the args when it creates a new URL. It will require a patch on set_links so you can pass custom args and vars to URL. -- Thadeus On Wed, Nov 10, 2010 at 4:36 PM, Andrew Evans wrote: > I just noticed the difference in URLs > > https://127.0.0.1:8000/Working/display/product_wall/405

[web2py] Re: Pagination [Web2py Utils] returns None

2010-11-10 Thread Andrew Evans
I just noticed the difference in URLs https://127.0.0.1:8000/Working/display/product_wall/4056 above is the comments on the product notice the id. below is the next link of the pagination https://www.127.0.0.1:8000/Working/display/product_wall?p=5 it loses the 4056 which is the id of the produ

[web2py] Re: Pagination manual bug?

2010-08-26 Thread Niphlod
@dlin: it doesn't works because URL helper has been "improved" lately, in case you were asking yourself. PS: sadly if you put "web2py pagination" on google, the first link that appears is from mengu.net and that implementation is wrong, also if the analysis is correct. limitby works like python

[web2py] Re: Pagination manual bug?

2010-08-25 Thread mdipierro
This is not a bug. the manual syntax is correct for web2py 1.83.1 and beyond. On Aug 24, 10:56 pm, dlin wrote: > As I know, at least this is manual's bug. > > In the mannual, it use > next > > But, it will raise error, I use this line instead > next > > On 8月25日, 上午1時55分, Vidul Petrov wrote: > >

[web2py] Re: Pagination manual bug?

2010-08-24 Thread dlin
As I know, at least this is manual's bug. In the mannual, it use next But, it will raise error, I use this line instead next On 8月25日, 上午1時55分, Vidul Petrov wrote: > Not sure if this help, but you may want to take a look at this > Pagination class:http://packages.python.org/web2py_utils/paginat

[web2py] Re: Pagination manual bug?

2010-08-24 Thread Vidul Petrov
Not sure if this help, but you may want to take a look at this Pagination class: http://packages.python.org/web2py_utils/paginate.html On Aug 24, 6:37 pm, dlin wrote: > ref:http://web2py.com/book/default/chapter/12#Pagination > > In following code, there is two problem: > 1. The 'next' button alw