Open evollution opened 4 years ago
params {'draw': '1', 'columns[0][data]': '0', 'columns[0][name]': '', 'columns[0][searchable]': 'true', 'columns[0][orderable]': 'true', 'columns[0][search][value]': '', 'columns[0][search][regex]': 'false', 'columns[1][data]': '1', 'columns[1][name]': '', 'columns[1][searchable]': 'true', 'columns[1][orderable]': 'true', 'columns[1][search][value]': '', 'columns[1][search][regex]': 'false', 'order[0][column]': '0', 'order[0][dir]': 'asc', 'start': '0', 'length': '10', 'search[value]': '', 'search[regex]': 'false', '_': '1584207848563'}
{'draw': '1', 'recordsTotal': '13997', 'recordsFiltered': '13997', 'data': [{'0': <Customer#1>, '1': 1}, {'0': <Customer#2>, '1': 2}, {'0': <Customer#3>, '1': 3}, {'0': <Customer#4>, '1': 4}, {'0': <Customer#5>, '1': 5}, {'0': <Customer#6>, '1': 6}, {'0': <Customer#7>, '1': 7}, {'0': <Customer#8>, '1': 8}, {'0': <Customer#9>, '1': 9}, {'0': <Customer#10>, '1': 10}]}
This is the (rowTable.output_result() output
Another issue, because as item[0] is returned the query itself, item[-1] is missing :( @Pegase745 can you take a look why it returns item[0] as a query object instead of the first columnDT selected?
I had the same problem. Try using a query like in the example with select_from
query = db.session.query().select_from(Customer)
This worked for me. SOmehow the framework can't work with DB objects sadly.
heh, wish it was just db types ... "int() argument must be a string, a bytes-like object or a number, not 'NoneType'"
... hmmmm
heh, wish it was just db types ...
"int() argument must be a string, a bytes-like object or a number, not 'NoneType'"
... hmmmm
This happens mostly if any of the values required are not set. I figured out that the framework assumes that at least "start" and "length" are set when init is called. my quick workaround for that:
params = request.args.to_dict() if "start" not in params: params["start"] = 0 if "length" not in params: params["length"] = -1
some error handling would have been nice here.
Good to know, thanks :) Maybe this should actually be a PR.
and i get error: Object of type Customer is not JSON serializable