Hi,
thanks for your post, and sorry for the trouble.
You could turn off the sorting function for all tables (including new ones) by adding this custom PHP code to your theme’s “functions.php”:
add_filter( 'tablepress_table_render_options', 'kb959fl_turn_off_sorting', 10, 2 );
function kb959fl_turn_off_sorting( $render_options, $table ) {
$render_options['datatables_sort'] = false;
return $render_options;
}
Regards,
Tobias
Hi Tobias,
Thanks for the quick reply and info. I actually need to enable the sorting function for all of them, so would I just replace “turn_off” to “turn_on” within the code?
On a side note, I’m also having an issue with the “FixedHeader” plugin. Is it okay to ask it here or should I create a new post/thread?
Hi,
ok, now I’m confused. The “Sorting” checkbox is enabled by the default, so you should not have to do anything… Or did you turn it off manually?
To modify the code to turn it on, you would have to change “turn_off” to “turn_on” (twice!) and the false has to be changed to true.
Regards,
Tobias
Sorry for the confusion. Yes, unfortunately I had manually unchecked the “Sorting” box on all of the tables I created. I just enabled it on one of the tables to test it and I’m running into an issue with the sorting function working properly. Can you set this thread to private so I can include the URL to the page/table? My WP site is currently under development and I don’t want it public right now.
In regards to the “FixedHeader” plugin, the “horizontal scrolling” function does not seem to work when it’s enabled. It displays all of the columns which stretches the data out too far across the page. Is there a way to fix this? Thanks!
Hi,
no, sorry, I can’t set threads to private here, as I’m not a moderator (and I don’t think that the forums actually offer private threads).
Can you maybe post the URL after “hiding” it via e.g. https://bitly.com/ ?
For the FixedHeader: Yes, the JS code of that Extension does not support the Horizontal Scrolling feature, as far as I know. (I didn’t develop it, I only make it available as a TablePress Extension.)
Regards,
Tobias
Here is a quick example of the sorting issue. A descending column currently looks like this when sorted:
40
385
370
335
30
290
265
25
It should look like this:
385
370
335
290
265
40
30
25
Is there a way to fix this issue?
Hi,
that means that not all values in those columns are numbers, but strings (i.e. they also contain text).
You would have to remove those or change the sorting algorithm to a more sophisticated one (but to give details on that, I’d need to see the page).
Regards,
Tobias