removing / hiding SQLFORM.grid links in the view, edit, add forms?

39 views
Skip to first unread message

Paul Ellis

unread,
Dec 11, 2018, 6:10:02 PM12/11/18
to web...@googlegroups.com
I have a grid with some links. One of the buttons is a placeholder which some Jquery attaches to (useless in a the subforms). How do I stop this button from appearing in the subforms Edit and View.
I don't really want or need any of the links to appear in the subforms.

grid = SQLFORM.grid(query,
    links
= [
       
lambda row: 'returns a button',
       
lambda row: 'returns another button',
       
]
   
)

The only thing I can think of is something like this before the grid and the links = links in the grid:
if 'view' in request.args:
    links
= []
else:
    links
= [lambda, lambda, lambda]
Is there something already in the SQLFORM.grid which can do this?

** The links do not appear in the Add form. Just in the Edit and View form.

sandeep patel

unread,
Dec 12, 2018, 12:23:46 AM12/12/18
to web...@googlegroups.com
@Paul,
You can do this way,
grid = SQLFORM.grid(query,  editable=False,details=False,create=False,..)

Thanks
SP


On Wed, Dec 12, 2018 at 4:40 AM Paul Ellis <eddie....@gmail.com> wrote:
I have a grid with some links. One of the buttons is a placeholder which some Jquery attaches to. How do I stop this button from appearing in the subforms add, view etc.
I don't really want or need any of the links to appear in the subforms.

grid = SQLFORM.grid(query,
    links
= [
       
lambda row: 'returns a button',
       
lambda row: 'returns another button',
       
]
   
)

The only thing I can think of is something like this before the grid and the links = links in the grid:
if 'view' in request.args:
    links
= []
else:
    links
= [lambda, lambda, lambda]
Is there something already in the SQLFORM.grid which can do this?


--
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+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Paul Ellis

unread,
Dec 12, 2018, 4:16:40 AM12/12/18
to web2py-users
@Sandeep
That will disable the view, edit, create forms completely. I want to use the forms. I just don't want the extra buttons (links) which I use in the grid to appear in these forms.

You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/FcnXZz5dRqo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.

Paul Ellis

unread,
Dec 12, 2018, 4:52:20 AM12/12/18
to web...@googlegroups.com
After reading the sqlhtml.py for a while last night. I decided to use the same method.

if request.args(-3) in ('edit', 'view'):
    links = []
else:
    links = ['the many lambdas']

grid = SQLFORM.grid(
    query,
    editable = True,
    details = True,
    create = True,
    links = links,
    )


Reply all
Reply to author
Forward
0 new messages