Pegase745 / sqlalchemy-datatables

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

"Legacy datatables not supported, upgrade to >=1.10" with jsDataTables version 1.10.20 #123

Closed fancar closed 4 years ago

fancar commented 4 years ago

Hello!

I'm trying to put things together but get this error. However the version of js I use is 1.10.20.

with:

                    <table id="main_table">
                        <thead>
                          <tr>
                            <th>ticket_no</th>
                            <th>installer_id</th>
                          </tr>
                        </thead>
                    </table>

I get params: {'sEcho': '1', 'iColumns': '2', 'sColumns': ',', 'iDisplayStart': '0', 'iDisplayLength': '10', 'mDataProp_0': '0', 'sSearch_0': '', 'bRegex_0': 'false', 'bSearchable_0': 'true', 'bSortable_0': 'true', 'mDataProp_1': '1', 'sSearch_1': '', 'bRegex_1': 'false', 'bSearchable_1': 'true', 'bSortable_1': 'true', 'sSearch': '', 'bRegex': 'false', 'iSortCol_0': '0', 'sSortDir0': 'asc', 'iSortingCols': '1', '': '1574323302380'}

that include sEcho key.

flask endpoint

@app.route("/tablecontent") def table_content():

columns = [
    ColumnDT(Log.ticket_no),
    ColumnDT(Log.installer_id)
]    

query = db.session.query().select_from(Log)
params = request.args.to_dict()

logger.error(params)

rowTable = DataTables(params, query, columns)

return jsonify(rowTable.output_result()) 

ValueError: Legacy datatables not supported, upgrade to >=1.10

Am I doing something wrong? Thank you for your answer

fancar commented 4 years ago

Oops. messed up with bServerSide legacy param. Sorry