sorting trouble: super-long HTTP request strings
sorting trouble: super-long HTTP request strings
GrantB
Posts: 9Questions: 0Answers: 0
I have a very wide table, 44 columns.
I'm finding that when I sort, the AJAX HTTP request string is *very* long, so much so that if I add a hidden column, it exceeds a server-configured length and the server rejects it.
Here's what that looks like:
[code]Started GET "/trades/search.datatables?sEcho=3&page=1&per_page=10&search%5Bmeta_sort%5D=quanty.desc&columns%5B0%5D=&columns%5B1%5D=&columns%5B2%5D=&columns%5B3%5D=quanty&columns%5B4%5D=&columns%5B5%5D=&columns%5B6%5D=&columns... etc etc etc[/code]
Which my server is interpreting as:
[code]Parameters: {"sEcho"=>"1", "page"=>"1", "per_page"=>"10", "search"=>{"meta_sort"=>".asc"}, "columns"=>{"0"=>"", "1"=>"", "2"=>"", "3"=>"quanty", "4"=>"", "5"=>"", "6"=>"", "7"=>"", "8"=>"", "9"=>"", "10"=>"", "11"=>"", "12"=>"", "13"=>"", "14"=>"", "15"=>"", "16"=>"", "17"=>"", "18"=>"", "19"=>"", "20"=>"", "21"=>"", "22"=>"", "23"=>"", "24"=>"", "25"=>"", "26"=>"", "27"=>"", "28"=>"", "29"=>"", "30"=>"", "31"=>"", "32"=>"", "33"=>"", "34"=>"", "35"=>"", "36"=>"", "37"=>"", "38"=>"", "39"=>"", "40"=>"", "41"=>"", "42"=>""}}[/code]
Note: I only provided an sName for "quanty", thus why the rest appear un-named.
It looks like datatables is sending the entire mapping of col-index to col-name to the server. Is this necessary?
(I see that "sServerMethod" is available to change it to POST, but it seems that my version of 1.8 does not have it.)
I'm finding that when I sort, the AJAX HTTP request string is *very* long, so much so that if I add a hidden column, it exceeds a server-configured length and the server rejects it.
Here's what that looks like:
[code]Started GET "/trades/search.datatables?sEcho=3&page=1&per_page=10&search%5Bmeta_sort%5D=quanty.desc&columns%5B0%5D=&columns%5B1%5D=&columns%5B2%5D=&columns%5B3%5D=quanty&columns%5B4%5D=&columns%5B5%5D=&columns%5B6%5D=&columns... etc etc etc[/code]
Which my server is interpreting as:
[code]Parameters: {"sEcho"=>"1", "page"=>"1", "per_page"=>"10", "search"=>{"meta_sort"=>".asc"}, "columns"=>{"0"=>"", "1"=>"", "2"=>"", "3"=>"quanty", "4"=>"", "5"=>"", "6"=>"", "7"=>"", "8"=>"", "9"=>"", "10"=>"", "11"=>"", "12"=>"", "13"=>"", "14"=>"", "15"=>"", "16"=>"", "17"=>"", "18"=>"", "19"=>"", "20"=>"", "21"=>"", "22"=>"", "23"=>"", "24"=>"", "25"=>"", "26"=>"", "27"=>"", "28"=>"", "29"=>"", "30"=>"", "31"=>"", "32"=>"", "33"=>"", "34"=>"", "35"=>"", "36"=>"", "37"=>"", "38"=>"", "39"=>"", "40"=>"", "41"=>"", "42"=>""}}[/code]
Note: I only provided an sName for "quanty", thus why the rest appear un-named.
It looks like datatables is sending the entire mapping of col-index to col-name to the server. Is this necessary?
(I see that "sServerMethod" is available to change it to POST, but it seems that my version of 1.8 does not have it.)
This discussion has been closed.
Replies
Allan
[code]"sServerMethod": "POST",[/code]
Are there any known issues that could explain this?
For more context, the full config is:
[code]$("#trades_tbl").dataTable({
"sAjaxSource" : "/trades/search.datatables",
// "aaSorting" : [[0,'asc']], // sorting on initialization
"bServerSide" : true,
"fnServerData" : simpleDatatables,
"bFilter" : false,
"sServerMethod": "POST", // table size means the urls are really log
"sDom" : "lfriptip",
// pagination
"aLengthMenu" : [10,50,100,500,1000],
"bPaginate" : true,
"bLengthChange" : true, // lets user choose number of records from menu
"sPaginationType" : "input",
"aoColumnDefs": [
{ "aTargets": ["id"], "bVisible":false },
{ "aTargets": ["quanty"], "sName":"quanty", "bSortable":true },
{ "aTargets": ["_all"], "bSortable":false, "bSearchable":false },
],
});
[/code]
You are making your own Ajax call, so I presume that is doing GET rather than POST.
Allan
(The simple_datatables gem is the beginning of something nice for Rails users, but it's just not quite all the way there.)
i am using data table
in which i use dwr.util.addRows() method to create row at run on ajaxRespose.
the proble is that, when i do any text to search in table, or i click on sort button of any column,
all row disappear and never comes back.