Works perfect. Thank you Massimo.

On Sun, Sep 23, 2012 at 8:16 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> Can you please try again?
>
>
> On Sunday, 23 September 2012 18:03:48 UTC-5, Adi wrote:
>
>> Thanks Massimo!
>>
>> I'm trying to test it, but got this error bellow:
>>
>>   File "/Users/adnan/web2py-trunk/**gluon/sqlhtml.py", line 2280, in 
>> smartgrid
>>
>>     linked_tables = linked_tables.get(tablename,[]**)
>> UnboundLocalError: local variable 'tablename' referenced before assignment
>>
>>
>>
>> On Sun, Sep 23, 2012 at 5:31 PM, Massimo Di Pierro <massimo....@gmail.com
>> > wrote:
>>
>>> I just added the syntax you requested:
>>>
>>> linked_tables=dict(parent=['**ch**ild'], child=[])
>>>
>>> Please help me test it.
>>>
>>>
>>> On Saturday, 22 September 2012 18:55:57 UTC-5, Adi wrote:
>>>>
>>>> If I may rephrase and clarify a question:
>>>>
>>>> Is it possible to add control, through dictionary in (smartgrid)
>>>> linked_tables when will links display?
>>>>
>>>> e.g: linked_tables=dict(parent=['**ch**ild'], child=[''])
>>>>
>>>> wishful outcome: display children links for parent table, but don't
>>>> display any related links for child table.
>>>>
>>>> Thanks,
>>>> Adnan
>>>>
>>>>
>>>> On Friday, September 21, 2012 11:58:05 AM UTC-4, Adi wrote:
>>>>>
>>>>> I'm wondering what to do in this situation? I have self-referencing
>>>>> fields in the child table, and due to that smartgrid display links, which
>>>>> basically can't do anything.
>>>>>
>>>>> I'm trying to eliminate them, but not sure what would be a proper way?
>>>>>
>>>>> Thanks.
>>>>>
>>>>> Simplified code sample:
>>>>> db.define_table('campaign',
>>>>>                     Field('tbl_uuid', length=64, default=lambda:str(
>>>>> uuid.uuid4(****))),
>>>>>                     Field('name','string', label=T('Campaing Name')),
>>>>>                     format='%(name)s',
>>>>>                     )
>>>>>
>>>>> db.define_table('message',
>>>>>                     Field('tbl_uuid', length=64, default=lambda:str(
>>>>> uuid.uuid4(****))),
>>>>>                     Field('name','string', label=T('Name')),
>>>>>                     Field('campaign_id', 'reference campaign', label=T
>>>>> ('Campaign')),
>>>>>                     Field('action_yes_id', 'reference message)', label
>>>>> =T('Action Yes'),),
>>>>>                     Field('action_no_id', 'reference message)', label=
>>>>> T('Action No')),
>>>>>                     migrate=True)
>>>>>
>>>>>
>>>>>
>>>>> grid=SQLFORM.smartgrid(Campaig****n, details=False, links_in_grid=True
>>>>> ,
>>>>>                     linked_tables=['message'],
>>>>> #                    linked_tables=dict(campaign=[****'message'],
>>>>> message=['']),
>>>>>                     links=dict(campaign=[lambda row:(_get_messages(row
>>>>> ))
>>>>>                                         ]),
>>>>>                     )
>>>>> Enter code here...
>>>>>
>>>>>
>>>>>  --
>>>
>>>
>>>
>>
>

-- 



Reply via email to