Hello,
I could sort it out...
For those who could be interrested, here under the key elements of my solution.
1. In the model, create the following functions (here for string and drop list):
def options_widget(field,value,**kwargs):
return SQLFORM.widgets.options.widget(field,value,_class="generic-widget",**kwargs)
def string_widget(field,value,**kwargs):
return SQLFORM.widgets.string.widget(field,value,_class='string',**kwargs )
In the controller, in the function that you want to contain the editing grid:
def my_function_name(): # here my tale name = t_txw_expense_template
if len(request.post_vars) >0:
for key, value in request.post_vars.iteritems():
(field_name,sep,row_id) = key.partition('_row_') # field_name will look like field_name_row_99
if row_id:
# the name of the attribute is used to know which row is involved
# for each field that you want to see:
db.t_txw_expense_template.f_expense_template.represent = lambda value, row: string_widget(db.t_txw_expense_template.f_expense_template, value,
**{'_name':'f_expense_template_row_%s' %
row.id})
db.t_txw_expense_template.f_header.represent = lambda value, row: string_widget(db.t_txw_expense_template.f_header, value,
**{'_name':'f_header_row_%s' %
row.id})
db.t_txw_expense_template.f_project.represent = lambda value, row: options_widget(db.t_txw_expense_template.f_project, value,
**{'_name':'f_project_row_%s' %
row.id})
# and so on...
form = SQLFORM.smartgrid(db.t_txw_expense_template, # and so on...
# selectable = dict(t_txw_expense_template= None)
selectable= lambda ids : redirect(URL('my_function_name',vars=request._get_vars)),
)
#remove selectable's checkboxes
form.elements(_type='checkbox',_name='records',replace=None)
return dict (form = form)
Hope this can help...