> The URL of these pages has the following
> format:http://localhost:8080/?tg_paginate_limit=8&tg_paginate_no=2http://localhost:8080/?tg_paginate_limit=8&tg_paginate_no=3
> ... and so on.
>
> Now I want to alter this URL into the format:http://localhost:8080/method/x/2
You can create a new class that inherits the PaginateDataGrid widget
and override the template that generates the urls. In the controller/
method you are calling you can go thorugh the *args to get the page no
and add it to the **kwargs[''] for use in the paginate:
tg_paginate_no=args[1].
in my case i have:
@turbogears.expose()
def method(self, *args, **kwargs):
# URL is /method/letter/pagenumber
return self._directory(letter=args[0], tg_paginate_no=args[1])
# paginate: required for paginatedatagrid widget
@turbogears.expose(template="...mytemplate")
@turbogears.paginate('items', limit=int(config.get("showitems")))
def _directory(self, letter=""):
"""show the directory listing
letter : the letter selected by the user
"""
items = self._getitems(letter)
return dict(currentletter=letter, items=items,
pdgwidget=self.pdgwidget)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---