If you benefit from web2py hope you feel encouraged to pay it forward by contributing back to society in whatever form you choose!

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

Related slices

Comments (13)

  • Login to post



  • 0
    johannspies 13 years ago
    "git clone https://iiijjjii@github.com/iiijjjii/jqgrid.git" requires a password. Is there some other way to download the module?

  • 0
    iiijjjiii 13 years ago
    There should be no password on it. Try just clicking OK when prompted.

  • 0
    johannspies 13 years ago
    Thanks for your reply. I could download the module after pressing Enter at the password prompt: % git clone https://iiijjjii@github.com/iiijjjii/jqgrid.git Cloning into jqgrid... Password: remote: Counting objects: 212, done. remote: Compressing objects: 100% (182/182), done. remote: Total 212 (delta 43), reused 195 (delta 26) Receiving objects: 100% (212/212), 389.62 KiB | 150 KiB/s, done. Resolving deltas: 100% (43/43), done.

  • 0
    iiijjjiii 13 years ago
    I updated the jqgrid application default controller to include examples for the following: * Complex Query (under Custom Queries menu) The jqgrid includes a custom query, selected fields from table including a virtual field, a column with data not found in a table. The query accesses data with a left join and formats data prior to display. * Web Service Illustrates displaying a jqgrid table with data accessed from a webservice.

  • 0
    johannspies 13 years ago
    Thanks for the further examples. How would you handle the 'formatter': 'showlink' and 'baseLinkUrl': '' where uuid is used for cross references and a field is being represented by this: db.akb_articles.journal.represent = lambda x: db(db.akb_journal.uuid==x).select(db.akb_journal.title).first()['title'] I would like the 'journal' field in the grid to show the title of the journal and link to the record in akb_journal.
show more comments

Hosting graciously provided by:
Python Anywhere