Server-side Column has a limit?

Server-side Column has a limit?

hashsalacophashsalacop Posts: 19Questions: 5Answers: 0

I have a 173 columns on my table. its always saying the error "DataTables warning: table id=tbl-contact - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1" But if i put 165 column its working properly, My question is is there a way to fix this. if there is a limit of the column. "" here is my code

      var table = $('#tbl-contact').DataTable({
              "scrollX": true,
            "processing": true,

            "serverSide": true,
                "ajax": {
                  url:    "serverside.php",
                  type:   "POST"
              },
              retrieve: true,
            order: [[2, 'asc']],
            columnDefs: [{
                targets: "_all",
                orderable: false
             }]
        });

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,344Questions: 26Answers: 4,954
    Answer ✓

    I don't believe there are any limits in Datatables. Did you follow the steps provided in the at the link in the Invalid JSON response alert? That is the place to start to determine why the JSON is invalid. Let us know what you find.

    Kevin

  • hashsalacophashsalacop Posts: 19Questions: 5Answers: 0

    Yes i follow step by step. Actually its working if i remove 8 of the column header. and its working. but if i just add 1 column header automatic error.

  • kthorngrenkthorngren Posts: 21,344Questions: 26Answers: 4,954

    One of the steps is to use the jsonlint parser. Did you try that? What did you find?

    Kevin

  • kthorngrenkthorngren Posts: 21,344Questions: 26Answers: 4,954

    Another thing to try is to return just those 8 columns to see if you get the error. But without knowing what the response is using the developer tools its hard for us to offer suggestions.

    Kevin

  • hashsalacophashsalacop Posts: 19Questions: 5Answers: 0

    Hi kthorngrenkthorngren, I just tried https://jsonlint.com/ and its valid.. But if remove any header of my column and if its 8 its working and i check the value on the console the value is completely working.. only if the header is more than 165 there is an error.

  • kthorngrenkthorngren Posts: 21,344Questions: 26Answers: 4,954

    Without seeing it its hard to say. Maybe the best option is to use the debugger and post the debugger ID here for the developers to take a look.

    Kevin

  • hashsalacophashsalacop Posts: 19Questions: 5Answers: 0

    thanks for your help kthorngrenkthorngren .. when using the server-side ajax. Do we have a column header limit?

  • kthorngrenkthorngren Posts: 21,344Questions: 26Answers: 4,954

    Take a look at this thread:
    https://datatables.net/forums/discussion/comment/122186/#Comment_122186

    The developer states:

    DataTables itself doesn't have a limit

    The OP is using 1600 columns.

    Again, without seeing what the response is its hard to help. You can post the JSON response here. Or you can use the debugger ,which will have the response, and post the debug ID for the developers to take a look.

    Kevin

  • hashsalacophashsalacop Posts: 19Questions: 5Answers: 0

    Here is the response i get if i remove 8 header column.

    Here is the response error if i add one header column

  • kthorngrenkthorngren Posts: 21,344Questions: 26Answers: 4,954

    I understand the above. What I'm asking for is that you either copy and paste the data from the Response tab (not a screenshot but text) here or use the debugger to gather the information when you get the error.

    What we are interested in is what the Response tab contains when you get the error.

    Kevin

  • kthorngrenkthorngren Posts: 21,344Questions: 26Answers: 4,954

    Don't post the text if you have sensitive information. Use the debugger instead. Only the developers have access to the debugger output.

    Kevin

  • pkanepkane Posts: 1Questions: 0Answers: 0

    Hi hashsalacop,

    How did you resolve this issue? I'm having the same problem of not being able to have more than 165 columns.

    Thanks

  • kthorngrenkthorngren Posts: 21,344Questions: 26Answers: 4,954

    The first step is to determine where the error is occurring. What errors are you seeing with more than 165 columns?

    Basically you need to determine if the server script is has an error with > 165 columns or more likely its a problem with using AJAX GET to send the request. Which you need to change to use POST.

    Without know what you have and the errors you are getting its hard to say where the problem might be.

    Kevin

  • allanallan Posts: 63,540Questions: 1Answers: 10,476 Site admin

    If you are using PHP increase your max_input_vars configuration option. That's the most common cause for this issue.

    Allan

  • anguswildanguswild Posts: 4Questions: 1Answers: 1

    My God allan, thank you very much for leaving this comment more than a year ago, I was looking for a problem for days until I checked max_input_vars in the php.ini. And now my problem is gone!

This discussion has been closed.