>
> I'm using SQLFORM.grid and would like to update the fields of a table 
> via AJAX without the user having to click edit then submit in a new 
> page. 
> eg. I have a table, one of the columns is a boolean value (this gets 
> displayed as a checkbox), the user can click the checkbox and the 
> table gets updated automatically.
>

The grid is relatively new functionality. It doesn't currently support 
inline editing, so you'll have to code something like that on your own. For 
an alternative (or at least for ideas), check 
out http://www.ebansoftware.net/en/prodotti/item/9-editable-jqgrid.
 

>
> A related problem, assigning a class or id to the rows or columns so 
> javascript can respond to changes in the table entries.
>

Maybe we should add id's automatically. For now, you might try something 
like this:

tbody = grid.element('tbody')
if tbody:
    for tr in tbody:
        for i, column in enumerate(db.mytable.fields):
            tr[i]['_id'] = column
 
Another option is to use CSS nth-child references to identify each column 
on the client side (e.g., td:nth-child(3) refers to the third td in a give 
row).


> Another request is a way to specify my own create and edit forms. If 
> the grid is created on a join, then the create and edit forms are 
> based on only one table. Perhaps there is also a clever automatic way 
> to generate a form based on a join.
>

To create a form based on two tables, 
see http://web2py.com/books/default/chapter/29/7#One-form-for-multiple-tables.

Anthony
 

Reply via email to