How did you insert icons for edit in your form

I am using SQLFORM.smartgrid and I want my grid to be more bootstrap like. 

Also I am having problems with displaying my child table fields (They are 
not displayed :))

Any suggestions?


Here is my code

workers = db(db.worker.w_organisation == 10).select(db.worker.id, 
db.worker.w_organisation, db.worker.w_first_name, 
db.worker.w_last_name,db.worker.w_nick_name,db.worker.w_email,db.worker.w_status,db.worker.w_note).as_list()
 #Define the query object. Here we are pulling all contacts having date of 
birth less than 18 Nov 1990
query = ((db.worker.w_organisation == 10) )#& 
(db.worker.w_status==db.status.s_id_s))
 
#Define the fields to show on grid. Note: (you need to specify id field in 
fields section in 1.99.2
fields = (db.worker.id,db.worker.w_first_name, 
db.worker.w_last_name,db.worker.w_nick_name,db.worker.w_email,db.status.s_code,db.worker.w_note)
 #Define headers as tuples/dictionaries
headers = {'worker.id' :   'Id', 
'worker.w_first_name' :   'Ime',
   'worker.w_last_name' : 'Priimek',
   'worker.w_nick_name' : 'Vzdevek',
   'worker.w_email' : 'E-posta',
   'status.s_code': 'Status',
   'worker.w_note' : 'Komentar' }
 #Let's specify a default sort order on date_of_birth column in grid
default_sort_order=[db.worker.w_last_name]
 form = SQLFORM.smartgrid(db.worker,fields = fields,headers= 
headers,linked_tables=['status'])


And db.py

db.define_table('worker',
Field('id', type ='id'),
Field('w_organisation', type ='integer'),
Field('w_user', type ='integer'),
Field('w_status', 'reference status'),
Field('w_first_name',type='text'),
Field('w_last_name',type='text'),
Field('w_nick_name',type='text'),
Field('w_email',type='text'),
Field('w_note',type='text'),
migrate=settings.migrate
)

db.define_table('status',
Field('s_id_s', type ='id'),
Field('s_code', type ='text'),
Field('s_description', type ='text'),
migrate=settings.migrate
)

thank you 

best regards


On Friday, September 21, 2012 5:58:05 PM UTC+2, 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(Campaign, 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...
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to