From faecb124cc8aea650d8802df4340f4123e01f20d Mon Sep 17 00:00:00 2001 From: Tim Richardson Date: Wed, 29 Jan 2014 18:55:32 +1100 Subject: [PATCH] fixed a bug in SQLFORM.grid where export would fail if a search filter applied to a non-visible column --- gluon/sqlhtml.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gluon/sqlhtml.py b/gluon/sqlhtml.py index 11206dbd..573b498f 100644 --- a/gluon/sqlhtml.py +++ b/gluon/sqlhtml.py @@ -2191,8 +2191,11 @@ class SQLFORM(FORM): if export_type in exportManager and exportManager[export_type]: if request.vars.keywords: try: + #the query should be constructed using searchable fields + sfields = reduce(lambda a, b: a + b, + [[f for f in t if f.readable] for t in tables]) dbset = dbset(SQLFORM.build_query( - fields, request.vars.get('keywords', ''))) + sfields, request.vars.get('keywords', ''))) rows = dbset.select(left=left, orderby=orderby, cacheable=True, *expcolumns) except Exception, e: