On Thu, Nov 10, 2011 at 12:26 PM, Anthony <[email protected]> wrote:
> On Thursday, November 10, 2011 12:25:09 PM UTC-5, Anthony wrote:
>>
>>
>> When you first call this function, there will be no form.create_form
>> because it's just generating the grid. When you click on the "Add" button,
>> it should call this same function, but with "new" as one of the URL args.
>> So, I guess you'd have to add an "if 'new' in request.args:" condition.
>>
>
> Actually:
>
> if form.create_form:
>
> should work as well.
>
"if 'new' in request.args:" works (allow to load the grid) but the "if
form.create_form:" not work alone or in conjunction with the former :
def test_sqlformgrid():
table = SQLFORM.grid(db.TABLE, ui='jquery-ui',
editable=auth.has_membership('reviewer'),
deletable=auth.has_membership('reviewer'), formstyle = 'divs')
if 'new' in request.args:
if form.create_form: # not working neither without the if 'new'...
for i in range(0,len(form.create_form[0])):
if len(form[0][i][2][0]) > 0:
form[0][i][0].append(SPAN((helpicon(),
SPAN(form[0][i][2][0])),_class='tooltip'))
del(form[0][i][2])
return dict(table=table)
Richard