add new button in GRID with same look and feel

135 views
Skip to first unread message

Sarbjit

unread,
Nov 4, 2013, 6:24:13 AM11/4/13
to
I have added a new button in grid using links as below :-

    links = [dict(header='',  body=lambda row: A('CustomButton',_class="w2p_trap button btn", _href=URL('customhandler',args=[row.id])))]

Is it possible that I can have the placement of this button under the same header where the default grid buttons ('Edit','View' or 'Delete') are placed and this should have the same look and feel.

Otherwise, the new button looks very odd in the grid from the other buttons, view/edit pages are OK as the new button is aligned with existing buttons. Its just the main grid layout which requires modification. Any pointers/suggestions? Can I have the new button visible only under Edit/View and not under main grid (This is better than the odd look).

 

Sarbjit

unread,
Nov 4, 2013, 6:39:46 AM11/4/13
to web...@googlegroups.com

Sarbjit

unread,
Nov 4, 2013, 9:25:24 PM11/4/13
to web...@googlegroups.com
I was wondering if I could add the grid default buttons ('View','Edit','Delete') inside the links and turn off the default buttons visibility. This way the new button and other buttons would be of same style. Only problem is that the default buttons used to pass "signature" and other arguments, but I am not sure what arguments needs to be passed.

Please comment if this is the right approach or I could just append the new button to the existing buttons (row), also please let me know if this is feasible or not.

Mirko

unread,
Nov 15, 2013, 3:21:43 AM11/15/13
to web...@googlegroups.com
Hi Sarbjit,
did you manage to have the placement of your button under the same header where the default grid buttons are ?
I'm also unsuccessful here...
Thanks!
Mirko

Sarbjit

unread,
Nov 15, 2013, 3:37:20 AM11/15/13
to web...@googlegroups.com
Hi Mirko,

I am not able to figure out a way so far :(

But I feel the best way is to create a new header and add existing buttons (Add/Delete/View) in them along with other buttons. But I still need to figure out how this can be done i.e. passing the correct arguments (signature) etc.

-Sarbjit
 

Mirko

unread,
Nov 15, 2013, 3:50:44 AM11/15/13
to web...@googlegroups.com
Just figured out how to do that :

links=[
   
{'header':'...','body':lambda row: ...},
   
lambda row: TAG.button(T('Accept'),_type="button",_onclick='alert("%s")'%row.id)
   
]

the second item of links list goes with the delete/view/edit buttons...

Hope it helps,

Mirko

Sarbjit

unread,
Nov 15, 2013, 4:03:21 AM11/15/13
to web...@googlegroups.com
Thanks !!
Reply all
Reply to author
Forward
0 new messages