SQLFORM.grid - Readable True, but hide the column in table

69 views
Skip to first unread message

Jitun John

unread,
Jul 16, 2021, 11:56:43 AM7/16/21
to web2py-users
With the following code, I can search log_path info

    db.ftp_simplivity_log_db.log_path.readable = True
    ftp_simplivity_log_grid = SQLFORM.grid(db.ftp_simplivity_log_db,
                                           searchable=True,
                                           advanced_search=False,
                                           orderby=~db.ftp_simplivity_log_db.log_date,
                                           sortable=True,
                                           details=False,
                                           csv=False,
                                           paginate=50,
                                           maxtextlengths={'ftp_simplivity_log_db.log_date': 100, 'ftp_simplivity_log_db.log_path': 300},
                                           links=[lambda row: A('SimplifY --> ' + row.log_path, _href=URL('download_simplivity_log', args=row.id), _class='btn btn-light')])


with_log_path.jpg

But changing to False
db.ftp_simplivity_log_db.log_path.readable = False

without_log_path.jpg

The output looks clean, but search is not able to search the log_path,

without_log_path_search.jpg

Hence the question I have is,
Is there a way to keep
db.ftp_simplivity_log_db.log_path.readable = True
so search can work and still be able to hide it in the actual grid display ?

cdbaron

unread,
Jul 17, 2021, 8:52:36 AM7/17/21
to web2py-users
You should not use db.ftp_simplivity_log_db.log_path.readable = False
You have to use db.ftp_simplivity_log_db.log_path.listable = False

If you want to cancel the search for any field in the table you can use db.table.any_fielfd.searchable = Flase

Jitun John

unread,
Jul 19, 2021, 7:56:03 AM7/19/21
to web2py-users
Excellent. Exactly what I wanted.
Thanks a lot @cdbaron 
Reply all
Reply to author
Forward
0 new messages