XEditable fails with DataTables warning: table id=DataTables_Table_0 - Ajax error
I am using an XEditableDatatableView in my app. But the view fails to render the table and displays the following warning:
DataTables warning: table id=DataTables_Table_0 - Ajax error. For more information about this error, please see http://datatables.net/tn/7
Inspecting the requests, the page tries to make a request (which fails with 502 error) with parameters ?draw=1, (and a bunch of column parameters).
The weird thing is: it works locally (same docker image). I am deploying to AWS Elastic Beanstalk with an Application Load Balancer. I think it has something to do with that. But I could not pinpoint the problem and wondered if you could enlighten me.
Comments (6)
-
-
repo owner I think this is not directly related to the django-datatables-view project itself but I’d check the load balancer logs and/or some http server that is used (eg. in docker). You might find this https://aws.amazon.com/premiumsupport/knowledge-center/load-balancer-http-502-errors/ helpful.
My guess would be that something is wrong with headers like content type or the size of the request (eg. cookie size or number of get parameters).
-
OK, thanks for the tip. If I find a solution, I’ll post it back here, maybe it can help somebody else.
-
Well, I found out a way to correct it: reducing the number of columns.
I was using 7 columns and the response generated a very long URL with a “draw” query paramerter (?draw=1&columns%5B0%5D%5Bdata%5D=0&columns%5B0%5D%5Bname%5D=id&columns%5B0%5D%5Bsearchable%5D=true&columns%5B0…)
I reduced the number of columns and it started working. I had probably reached a URL max length limit with all those columns.
If you happen to know any other way to circumvent this limitation, I would be glad to be able to use 7 columns again
-
Are you making the datatables request via GET or POST? By the long url, it looks to be GET. If you change it to POST you shouldn't have the learn url concerns, and if you're using x-editable to change server side data, a POST is a touch more secure.
-
Is there a way to configure that in datatables-view? This request is made by the code in this repo.
- Log in to comment
I opened the issue above, did not see I was not logged in.
Quick correction: it works when running django local runserver. But it fails when deploying the same docker image locally, as it fails deploying it to AWS. With the exception that locally it does not display any warning pop-up.