400 Bad Request

400 Bad Request

btzbtz Posts: 22Questions: 0Answers: 0
edited December 2011 in General
Hi,
I have very large DT, 395 columns (days in year+month).

Not I get "400 Bad request" because my json request url length is over 7000 chars.

Example json request:
get.php?c=1&sEcho=1&iColumns=395&sColumns=&iDisplayStart=0&iDisplayLength=-1&mDataProp_0=0&mDataProp_1=1&mDataProp_2=2....&mDataProp_394=394&_=1323257078340

I do not have any sorting or filtering etc.

How do I shorten json request?

Replies

  • allanallan Posts: 63,546Questions: 1Answers: 10,476 Site admin
    395 columns - nice!

    What to do, I would say, is not try and shorten the request (although you could remove some of the properties you don't need by modifying the core if you wanted), but rather, just POST the request rather than using the default GET: http://datatables.net/release-datatables/examples/server_side/post.html (this method needs v1.8.2 btw).

    Regards,
    Allan
  • GregPGregP Posts: 500Questions: 10Answers: 0
    Yup yup yup! But I could've sworn we've been able to use POST before 1.8.2. Am I going mad?
  • allanallan Posts: 63,546Questions: 1Answers: 10,476 Site admin
    You could to - but you had to define fnServerData. 1.8.2 introduced a new parameter, sServerMethod that makes it much easier to use POST rather than GET (since that was the reason for overriding fnServerData in most cases).

    Allan
  • btzbtz Posts: 22Questions: 0Answers: 0
    Thanks again allan!
  • btzbtz Posts: 22Questions: 0Answers: 0
    Hmm.. I use FixedHeader 2.0.5.dev with this DT.
    With this POST it does not work, columns does not line-up..
  • allanallan Posts: 63,546Questions: 1Answers: 10,476 Site admin
    I doubt that it is the POST that is causing that. Can you give us a link please?

    Allan
  • btzbtz Posts: 22Questions: 0Answers: 0
    Here is link: http://www.tulospalvelu.biz/dt/pp.php
  • allanallan Posts: 63,546Questions: 1Answers: 10,476 Site admin
    Okay, the table is smaller in width than it is possible to make the header. You got different styling applied to the header than you have to the main table's header (i.e. without the Fixed header). The two must has the same styling, or the main table must be slightly bigger since you can't make the header smaller than it can possibly be!

    Allan
  • btzbtz Posts: 22Questions: 0Answers: 0
    Oh,
    can you point me to the right direction how to make those stylings same? :)
  • allanallan Posts: 63,546Questions: 1Answers: 10,476 Site admin
    I'd use Firebug/Inspector to have a look at what styles are applied to the fixed header and what styles are applied to the static one. Specifically it looks like

    ".ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default"

    is applied to the static header only.

    Allan
  • btzbtz Posts: 22Questions: 0Answers: 0
    I don't quite follow you now.. :)

    Does "bJQueryUI":true have something to do with this?
  • allanallan Posts: 63,546Questions: 1Answers: 10,476 Site admin
    Have a poke at the two headers with Firebug or Inspector and you should see what I mean.

    Allan
  • btzbtz Posts: 22Questions: 0Answers: 0
    Okay, I had my own class for this dt, I changed it back to "display" so now it works but is wider :)

    One more question. How to use FixedHeader with Tabs? I have three DTs, own Tab for each.
  • markjomarkjo Posts: 66Questions: 0Answers: 0
    This issue is solved here: http://datatables.net/blog/localStorage_for_state_saving
    I post for the people who would miss this option.
This discussion has been closed.