I need to edit the entries of the "default rows per page" option both in terms of a) the options present (e.g., I need to add 1000, 5000, etc.) and b) remove the option for "All" as this will choke my DB/server. I know you can specify limits if server-side processing is disabled, but I want to keep it on.
Could one of your developers please advise the easiest way to do this. I know the DataTables library allows the lengthparameter (and would strongly recommend you let users customize this option as well going forward).
If possible, can you suggest filters to use along with a toy example? If that can't be done, can you point me where to look in the code?
We don't have a built in option to achieve this, but there is a workaround you can try.
You need to open this file: ../wp-content/plugins/wpdatatables/templates/admin/table-settings/table_settings_block.inc.php and around line 367 you'll see this:
Then you will see the options look like that, in the plugin, on table's Display tab :
-
Then, open ../wp-content/plugins/wpdatatables/source/class.wpdatatable.php and around line 3737 ( or search for "aLengthMenu", and replace the values as needed, in my example like this:
if you wish to add that value to possible column options (if you have a select-box filter, or selectbox editor input type, this would be the number of values displayed in those drop-downs).
Please make sure to delete cache in your browser after you apply the changes.
It works on my Test table, and Test site; let me know if it works for you
Hello,
I need to edit the entries of the "default rows per page" option both in terms of a) the options present (e.g., I need to add 1000, 5000, etc.) and b) remove the option for "All" as this will choke my DB/server. I know you can specify limits if server-side processing is disabled, but I want to keep it on.
Could one of your developers please advise the easiest way to do this. I know the DataTables library allows the length parameter (and would strongly recommend you let users customize this option as well going forward).
If possible, can you suggest filters to use along with a toy example? If that can't be done, can you point me where to look in the code?
Thanks!
Hi, Ben
Sorry for the delay
-
We don't have a built in option to achieve this, but there is a workaround you can try.
You need to open this file: ../wp-content/plugins/wpdatatables/templates/admin/table-settings/table_settings_block.inc.php and around line 367 you'll see this:
* When searching the code, it is best to search for a phrase using CTR+F, since our devs might add new lines of code during Updates,
so i advise to search for "Rows per page selection" , and you will find the comment right above this code :
Then you can change the options as you need them,
for this example, i reorder some values, i added "15", and changed "All" to "1000".
Then you will see the options look like that, in the plugin, on table's Display tab :
-
Then, open ../wp-content/plugins/wpdatatables/source/class.wpdatatable.php and around line 3737 ( or search for "aLengthMenu", and replace the values as needed, in my example like this:
And the last thing to do is to go to line 544 of the same file ( or search for "setDisplayLength", and modify it so it looks like this:
So, again, change the values as needed.
You may also want to add the value in
../wp-content/plugins/wpdatatables/templates/admin/table-settings/column_settings_panel.inc.php
around line 570,
if you wish to add that value to possible column options (if you have a select-box filter, or selectbox editor input type, this would be the number of values displayed in those drop-downs).
Please make sure to delete cache in your browser after you apply the changes.
It works on my Test table, and Test site; let me know if it works for you
Thank you
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
Thank you for the extremely detailed answer! I know you are busy and appreciate the time it took!
I was actually able to get your wpdatatables_filter_table_description filter working as follows:
Maybe this will help someone else. Thanks for your help!
Hi, Ben
Sorry for replying late
You're welcome, i am happy to help.
Thank you so much for this solution, we will make sure to make note of it,
in case if other users might need it.
Please don't hesitate to reach out to us if you need any assistance again.
Thank you
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables