Editable JqGrid is a plugin for web2py that make it easy to use JqGrid in your application.
What is Editable JqGrid
Editable JqGrid is a plugin for web2py that make it easy to use JqGrid in your application. It’s just a matter of install the plugin in the application and then call a single function from your controller. See example of use here. Editable JqGrid is still in Beta stage, so use at your own risk!
Web2py is a Free and open source full-stack enterprise framework for agile development of fast, scalable, secure and portable database-driven web-based applications. Written and programmable in Python .
What are web2py plugins
web2py plugins are self contained pieces of an application that can be added to any existing application. They usually define components, i.e. objects that can be embedded in a page and talk to the server via ajax. Often they include corresponding jQuery plugins and the serverside funcitonality to make them work. Here you can find some examples. The web2py admin interface provides a web interface to upload and manage the plugins. The plugin themsselves are .w2p files (as for web2py apps). There are just tar gzipped files containing the source code. You do not need to unzip them. The admin interface will unzip them on upload in web2py. Once a plugin becomes part of your app, you can customize it without affecting other apps. Look and feel can be customized via CSS.
- Inline editing of rows using web2py standard widgets
- Ajax updates,insertion,deletes of data
- Multiple grid in same page allowed
- Multiple database allowed
- Fully customizable by simple inheritance of a class (TODO)
- SQLTable similar syntax to easing the replace of your html table in existing application (TODO)
- Licensed under LGPL. You can use it in your commercial or open source application
Download version 0.2.0 from here
First and obviously, you have to have a web2py application. For this example, we have defined following model:
db_invoice = DAL('sqlite://invoice.sqlite')
This is standard w2p code… just an explanation on the function set_description_column. This is a function that let you define a default column to compute the description for a row of a table. The plugin use this information to show column values for reference column. Just pass the function the table you want to use as a reference and the name of the descriptive column.
Now to use Editable JqGrid, Just put following line in your controller:
And in your view:
Just that! And note that you must specify grid_name only if you want to use more than one grid in the same page, and db_name only if it differ from ‘db’.
To just use one simple grid, just use