Editor: AJAX error with too many columns

Editor: AJAX error with too many columns

burncharburnchar Posts: 118Questions: 12Answers: 0
edited December 2014 in Free community support

When using Editor with a table that has, in this case, 36 columns, I get "DataTables warning: table id={id} - Ajax error" as described here: http://datatables.net/manual/tech-notes/7

None of the troubleshooting steps are related, though. The problem appears to be because the GET request is too large -- and it's a monster:

GET http://localhost:62865/API/Rest?editorId=1&draw=1&columns%5B0%5D%5Bdata%5D=1&columns%5B0%5D%5Bname%5D=&columns%5B0%5D%5Bsearchable%5D=false&columns%5B0%5D%5Borderable%5D=true&columns%5B0%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B0%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B1%5D%5Bdata%5D=2&columns%5B1%5D%5Bname%5D=&columns%5B1%5D%5Bsearchable%5D=true&columns%5B1%5D%5Borderable%5D=true&columns%5B1%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B1%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B2%5D%5Bdata%5D=3&columns%5B2%5D%5Bname%5D=&columns%5B

That's a small piece of the request. In total, it's over 8000 characters.

Is there a fairly simple way to shorten this? I can't change the max URL length on the server, and I can't send the data through POST, which is what I'd usually do to send a lot of data, because I am using REST.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,722Questions: 1Answers: 10,108 Site admin
    Answer ✓

    Hi,

    You can use the ajax.data option and / or the preXhr event to modify the data that is being sent to the server.

    For example, if you can live without the column information entirely you could simply do:

    ajax: {
      url: ...,
      data: function ( d ) {
        delete d.columns;
      }
    }
    

    If you need some of the column information (which is likely!), but not the search information (possible), then you could loop over the columns array and delete the search object. That should save a lot of characters.

    Regards,
    Allan

This discussion has been closed.