In model
db.define_table('category',
Field('name', label='Name of Category'), format='%(name)s')
db.define_table('things',
Field('name'),
Field('quantity', 'integer'),
Field('owner'),
Field('price','double'),
Field('category', db.category))
In controller
JqGrid = local_import('jqgrid', app='jqgrid', reload=True).JqGrid
JqGrid.initialize_response_files(globals(), theme='ui-lightness', lang='en')
def things():
return dict(jqgrid=JqGrid(globals(), db.things)())
A view is not necessary, but can be used to customize the look. For example:
{{extend 'layout.html'}}
<h1>Things</h1>
{{=jqgrid}}
Comments (13)
- Login to post
order by: newest oldest upvoted downvoted
- iiijjjiii 9 years ago
- iiijjjiii 12 years ago
@telloroberto: I'm not quite sure exactly what you are after. Examples above show how the contents of a cell can be formatted as a link and on clicking the link a link_handler controller function can be called with the id of the record passed along. With that you have access to all the records fields including the cell field value.
JqGrid also permits calling a controller function on clicking a row within the grid. The id of the record represented in the grid row is passed along to the controller function. Here is the code from the example provided in the jqgrid application default controller.
show more comments0
sif-baksh-10957 9 years ago
Do you have an example how to use it with out a DB?
New to web2py
I'm making a restful API call that returns a JSON output
I would love to use this method.
Thanks in advance
replies (1)
0
luciusagarthy 10 years ago
Hey,
to my previous question: I found it out, it was enough to call:
before calling return dict()
0
luciusagarthy 10 years ago
Hallo,
nice job. I started with web2py week ago and want to implement jqgrid.
I am using my own db and cannot figure out, how to show column from foreignkey table, it is
showing just id column, but not name column (like db.thing with db.category.name in second column).
Another think: 'rownumbers': 'true' does not work properly, it adds column for rownumbers, but no rownumbers are shown,
just data are shift one column left :(, do not know if I have to manually add row numbers or jqgrid generates it.
Can you help. Sorry for my english, I am used just to read manuals :(.
0
joel-robinson-10375 12 years ago
I can't seem to figure out how to do and AND query. I tried somthing like this:
How can I combine queries?
Thanks for you help.
replies (1)
0
iiijjjiii 12 years ago