Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GET request sent when retrieving row details raise a "Request line is too large" JS error #114

Open
GGosseyn opened this issue Jun 8, 2023 · 1 comment

Comments

@GGosseyn
Copy link

GGosseyn commented Jun 8, 2023

Hello,
I use Django 3.2.15 and django-ajax-datatables 4.3.0.

I have a datatable with pre-filters which values are transmitted to the get_initial_queryset method.
When I expand the row details, a GET request, containing all the filters values (which can be numerous), is sent to the server (to the render_row_details() method).

Note: It seems that the 'extra_data' is delivered to the render_row_details() method since v4.2.0.

It isn't a problem in the development environment, as we have a limited amount of data in the filter values, but in PRODUCTION, we have a lot more. So, the GET request size limit is reached (around 2K chars).

As I tried to get a solution or a workaround, I noted that in the django-ajax-datatables code, the GET or POST http methods seems to be supported indifferently. So, as the POST method has no size limitation, I made a modification in my development environment in the file ajax_datatable/static/ajax_datatable/js/utils.js, at line 290 (still the same line in the master branch of the Github repo: https://github.com/morlandi/django-ajax-datatable/blob/master/ajax_datatable/static/ajax_datatable/js/utils.js).
I just added the http method type being POST, as follow:

284:             $.ajax({
285:                 url: url,
286:                 // data: {
287:                 //     action: 'details',
288:                 //     pk: rowData['pk']
289:                 // },
290: +               type: 'POST',
291:                 data: data,
292:                 dataType: 'json',
293:                 success: function(json) {

It tested and validated it in PRODUCTION and it works like a charm.
But I didn't perform extensive tests on every aspect of the django-ajax-datatables functionnalities, so I cannot guarantee it has no side effect at this point.

Do you think that it could be a solution on my issue and that it could be beneficial for other users of the django-ajax-datatables software ?
If the answer is positive, could this be incorporated in a future version of the software, as for now, I patched my version locally, which is not very clean, waiting for a more permanent solution.

Regards,
Olivier.

@morlandi
Copy link
Owner

morlandi commented Jun 8, 2023

Thank you @GGosseyn .. I think you can safely go ahead with POST.

I will include it in the library sooner or later, but would like to make some extensive tests before publishing.
I regret I do not have enough time available now, so let's keep the issue open ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants