This is a web2py plugin leveraging the framework's ajax options to provide inline row editing functionality to the SQLFORM.grid method. It aims to provide the same features provided by web2py's SQLFORM.grid in addition to inline row editing. Because the inline edit feature loads a SQLFORM into the selected row, the plugin will work properly only when the grid includes fields from a single table.
Download the .w2p file and install it as a plugin via the web2py interface.
Use the installation procedure above and overwrite the plugin content in your web2py app.
(1) Install the plugin.
(2) Import the SQLFORM_INLINE class to your controller.
from plugin_SQLFORM_INLINE import SQLFORM_INLINE
(3) Create a separate controller for each inline grid. If you plan to load more than one grid into a single controller, be sure to give each grid a unique formname.
def grid1(): SQLFORM=SQLFORM_INLINE grid1=SQLFORM.inline_grid(db.things, formname='grid1') return dict(grid1=grid1)
(4) Load the inline grid controller into your page using the web2py LOAD helper.
def index(): grid1 = LOAD(f='grid1.load', ajax=True, ajax_trap=True) return dict(grid1=grid1)
This plugin is intended to provide the same functionality offered by SQLFORM.grid, but is not fully tested and is currently in its initial stage of development. The CSS styling, in particular, is still a little buggy outside of Chrome.
If any of the options are not working properly, or if you have ideas on how to handle cross-browser styling, please feel free to let me know or, better yet, provide a proposed solution. I welcome any help or feedback to make this plugin as useful to the community as possible.