Anyway to get datatables to stop sending so much parameters in ajax URL string?

Anyway to get datatables to stop sending so much parameters in ajax URL string?

survalentsurvalent Posts: 7Questions: 3Answers: 1

I am using DataTable without filtering, paging, sorting.

Looking at 'decoded' url string sent by DataTable to my server on ajax request, it sends this for every column:

columns[0][data]=0&columns[0][name]=Pkey&columns[0][searchable]=true&columns[0][orderable]=false&columns[0][search][value]=&columns[0][search][regex]=false

I am using these parameters to configure the control:

               "ajax": {
                    "url": "AjaxHandler"
                },
                "serverSide": true,
                "processing": false,
                "paginate": false,
                "lengthChange": false,
                "searching": false,
                "ordering": false,
                "info": false,
                "autoWidth": false,
                "scrollY": tableHeight

One of my pages the table has 14 columns, and I am getting 404.15 error on its ajax requests: "The request filtering module is configured to deny a request where the query string is too long."

Once the above string is encoded for every column, it does indeed get very, very long. I realize that the quick solution is to configure the server to drop the limit - but still, most of those parameters are for features I am not using.

Any way to configure DataTable control to not include them?

(By the way this problem started when I switched to the new syntax, DataTables 1.10+, I haven't looked at what the previous version was sending, but apparently not as long)

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,262Questions: 1Answers: 10,423 Site admin
    Answer ✓

    You could use POST to send the data to the server, or use preXhr to modify the data that will be sent to the server.

    Allan

  • survalentsurvalent Posts: 7Questions: 3Answers: 1

    thank you, will try doing that in preXhr

This discussion has been closed.