Pegase745 / sqlalchemy-datatables

SQLAlchemy integration of jQuery DataTables >= 1.10.x (Pyramid and Flask examples)
MIT License
161 stars 65 forks source link

Table name ans search functionality errors? #29

Closed luciman closed 8 years ago

luciman commented 8 years ago

Hi,

I tried using your code in a flask sqlalchemy/postgresql setup in python 3.4 and in order to function I had change starting with row287:

           sort_name = '%s.%s' % (tablename, sort_name)

replaced with

           sort_name = '"%s".%s' % (tablename, sort_name)

as I was getting postgresql syntax errors regarding the sorting table name.

Also, in order to have a functional search function I changed: from row225:

                if condition is not None:
                    condition = and_(condition, and_(*conditions))
                else:
                    condition = and_(*conditions)

with

                if condition is not None:
                    condition = or_(condition, or_(*conditions))
                else:
                    condition = or_(*conditions)

Do you think there was another problem on my side or should I make a pull request? Thanks for your nice repo.

Pegase745 commented 8 years ago

Thanks for your feedback. I'll try your code, and keep you posted asap.

Pegase745 commented 8 years ago

could I ask what version of DataTables were you using ?

luciman commented 8 years ago

1.10.2 I was using your preview pyramid example and if I remove the bottom search (column based, <tfoot> tag) the top search doesn't function without the above modifications (I realized later the culprit). Thanks a lot!

Pegase745 commented 8 years ago

:+1: