Ordering/Searching stops working with more hidden columns
Ordering/Searching stops working with more hidden columns
I'm having a really weird problem that I can't figure out. I am trying to add some hidden columns that I can use to filter/search with. However, as soon as I add the additional columns to the targets field, ordering/searching stops working.
Here is before adding additional targets: http://d.umn.edu/sit/high-school/cits/dev/view.php
Here is after adding additional targets: http://d.umn.edu/sit/high-school/cits/dev/view2.php
Is this a bug or am I doing something wrong? Here is what I changed:
"columnDefs":
[
{
"targets": [ 14 ],
"visible": false
},
],
to
"columnDefs":
[
{
"targets": [ 14, 15, 16 ],
"visible": false
},
],
I am using the server-side processing files included with 1.10, only modifying the first with columns and information specific to my own database.
Answers
Actually, it seems to be related to the number of columns. Is there a limit on the number of columns you can work with in server-side? If I add a 16th column, it breaks and doesn't even show the data.
I have narrowed it down to this:
if ( isset($request['order']) && count($request['order']) )
In ssp.class.php.
I put some error_log calls and discovered that $request['order'] is no longer set with this many columns. So, this seems like a bug somewhere in the Datatables JS.
Pagination also no longer works.
I think your
<thead></thead>
needs<th></th>
tags for every column even when some columns are hidden. But I can't say if that will fix your problem. I don't see how the thing would fail beyond a certain number of columns, thoughThank you for the response. However, I have tried that to no avail.
Any other thoughts? I may have to switch back to 1.9 if there are no solutions.
I created an arbitrary table with 26 columns (a-z), without hiding any of them, and it definitely seems to be tied to number of columns.
http://d.umn.edu/sit/high-school/cits/dev/test/
Here is part of my server-side script, which is based on the included file.
$table = 'test';
$primaryKey = 'pkey';
$columns = array(
array( 'db' => 'a', 'dt' => 0 ),
array( 'db' => 'b', 'dt' => 1 ),
array( 'db' => 'c', 'dt' => 2 ),
array( 'db' => 'd', 'dt' => 3 ),
array( 'db' => 'e', 'dt' => 4 ),
array( 'db' => 'f', 'dt' => 5 ),
array( 'db' => 'g', 'dt' => 6 ),
array( 'db' => 'h', 'dt' => 7 ),
array( 'db' => 'i', 'dt' => 8 ),
array( 'db' => 'j', 'dt' => 9 ),
array( 'db' => 'k', 'dt' => 10 ),
array( 'db' => 'l', 'dt' => 11 ),
array( 'db' => 'm', 'dt' => 12 ),
array( 'db' => 'n', 'dt' => 13 ),
array( 'db' => 'o', 'dt' => 14 ),
array( 'db' => 'p', 'dt' => 15 ),
array( 'db' => 'q', 'dt' => 16 ),
array( 'db' => 'r', 'dt' => 17 ),
array( 'db' => 's', 'dt' => 18 ),
array( 'db' => 't', 'dt' => 19 ),
array( 'db' => 'u', 'dt' => 20 ),
array( 'db' => 'v', 'dt' => 21 ),
array( 'db' => 'w', 'dt' => 22 ),
array( 'db' => 'x', 'dt' => 23 ),
array( 'db' => 'y', 'dt' => 24 ),
array( 'db' => 'z', 'dt' => 25 ),
);
Greater than 16 columns is when Ordering/Paging/Searching breaks.
Equal to 16 columns is when it says "No matching records found", but at the same time says "Showing 1 to 2 of 2 entries".
I cannot post in Bug Reports, but this is definitely a bug.
Just in case anyone else has this issue: rolling back to 1.9 fixed it.