When too many rows are selected for removal, my data array is overwritten
When too many rows are selected for removal, my data array is overwritten
Hi folks,
I've been a datatables and editor user for a long time and it's great. Normally removing rows server-side works well, but when too many rows are selected (like over 30), the custom data parameter I need on the server side is omitted. It's the class of the object that will handle the request.
Here's my editor config:
editor = new $.fn.dataTable.Editor({
ajax: {
url: '/g4datatables_ajax_edit_router',
data: {
class: settings.tableClass,
},
},
table: "#datatable",
fields: settings.tableEditFields,
});
That "data.class" element doesn't get sent when too many rows are selected.
Any tips about what might be happening, and how I might proceed to fix it?
Thanks,
Tom
Answers
Have you verified this by using the browser's network inspector to see the Ajax request parameters that are sent?
The parameter should be a static parameter that is sent with each Editor request regardless of how many rows are sent.
Can you post a link to your page or a test case replicating the issue so we can help debug?
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Aha - yes I confirmed that it was being sent by the browser. My max_input_vars was set to 1000 in php.ini, and that was only enough for 32 rows of these large objects. So I can make it work by raising that value.
However, these vars are hardly required just in order to delete the server side objects. IDs would be enough. Is there a way to have editor send fewer vars per row?
Good that you found the issue. Here are a couple threads that might help:
https://datatables.net/forums/discussion/45278/why-delete-is-sending-all-the-fields-to-the-server-instead-of-only-the-id
https://datatables.net/forums/discussion/63030/why-datatable-editor-sends-all-parameter-on-delete-remove-action
Sounds like there are a couple options where you can remove the unneeded fields.
Kevin