You can't use this option out-of-the-box, but there's a way to do it.
You need to open this file: ../wp-content/plugins/wpdatatables/templates/admin/table-settings/table_settings_block.inc.php and around line 335 you'll see this:
And the last thing to do is to go to line 499 of the same file, and modify it so it looks like this:
public function setDisplayLength($length) {
if (!in_array($length, array(1, 5, 10, 12, 20, 25, 30, 50, 52, 100, 200, 1000))) {
return false;
}
So, again, replace -1 with 1000.
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.
Is there a way to achieve this without editing plugin files? Maybe through a hook or filter? Thanks!
Update: I was able to find a solution using your 'wpdatatables_filter_table_description' filter. My only question now, is if there is a way to add an option to the admin edit table page as well, so that a default value of "2" rows can be set? Thanks!
Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.
-
Aleksandar is on a Vacation, so I will take over this ticket.
We will share both methods with you, at the moment these are the only ways we have to change the 'default number of rows' at the table back-end settings, as well as the front-end, which you already figured out, via a hook wpdatatables_filter_table_description.
We don't have a built-in solution for this yet, but there is a workaround;
First for the front-end number of rows, by adding a hook to your active Theme or child Theme's functions.php file.
With this solution, it will not be affected by plugin updates
since it would pull the function from the Theme itself.
-
For example, if you need the same options for all tables,
add this hook: "wpdatatables_filter_table_description" to the active Theme's or child Theme's functions.php :
This hook is not going to change the options in the back-end table settings/Display settings, here the options will look the same :
But it will directly override the settings on the table itself, ( in both back and front-end),
so if we check on the table's available options for number of rows, it will then activate the hook's settings in the "Show Number of Entries" dropdown :
Of course, that was an example where we removed the "ALL" rows option,
but you can modify the hook, to change/add options you need.
-
Now, this other workaround is if you wish to change the available row options on the back-end of the table settings.
You also can't use this option out-of-the-box, but there's a way to do it.
* 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, then the exact line number changes,
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 option "15", and changed "All" to "1000".
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
Important to note :
During updates, this code will be overwritten, it will change to default code, so if you update the plugin, you have to repeat this process.
We will work on adding a better solution as soon as possible, for the time being, it is like that.
If you wish to affect the speed of development for these options,
to see if someone may be already suggested this feature. If you can't see it, feel free to add your suggestion there, and as more people vote, the feature will move higher on the priority list.
You can certainly follow our changeLog page if you'd like ( it is also available in the plugin dashboard), where we state any changes/new features/bug fixes during updates;
and our newsletter, so you're informed about new features, bug fixes, freebies, etc.
I followed your instruction, which works perfectly for my as well. I need 3 instead of 1 (3 medals).
As a suggestion for future updates: I would be helpfull to have the definition of selectbox row elements decided by the admin somewhere in the admin panel.
to see if someone may be already suggested this feature. If you can't see it, feel free to add your suggestion there, and as more people vote, the feature will move higher on the priority list.
You can certainly follow our changeLog page if you'd like ( it is also available in the plugin dashboard), where we state any changes/new features/bug fixes during updates;
and our newsletter, so you're informed about new features, bug fixes, freebies, etc.
I just did not understand your last reply - you wrote that there is a closed bracket missing if you filter for more than one table;
Would it be possible if you can open a new ticket and send us some screenshots/or a Video to elaborate a bit more on this issue - then we can try to reproduce it and see if it's a bug or just an error in the custom workaround?
My apologies once again for all the time between the replies.
I can see exactly what you mean now, thank you for pointing this out - when i tested it in the Visual Studio Code Editor, it has highlighted that missing bracket with red color straight away;
we have somehow missed it, but corrected it now for the future.
Thanks again for pointing it out for us;
and for the future improvement suggestion to add the native option.
If anything else comes up, please don't hesitate to open new tickets.
I'd like to change the default rows per page to 1000 and remove the All option. How would I do this?
Hello David
Thank you for your purchase.
You can't use this option out-of-the-box, but there's a way to do it.
You need to open this file: ../wp-content/plugins/wpdatatables/templates/admin/table-settings/table_settings_block.inc.php and around line 335 you'll see this:
You can replace the last option (All) with the 1000 option, like this:
And you'll have that option in the "Display" tab above the table:
Then, open ../wp-content/plugins/wpdatatables/source/class.wpdatatable.php and around line 3207, and replace "All" with 1000, so it looks like this:
And the last thing to do is to go to line 499 of the same file, and modify it so it looks like this:
So, again, replace -1 with 1000.
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.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
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
That worked perfectly. Thank you.
You're welcome, David
Glad I could be of service.
If you have any further questions or issues, please feel free to open a new ticket, and we'll gladly help.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
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
i want to remove/hide data view on default table. data will appear when performing a search in the search field. is it doable?
Hello Anto.
If you acquire the Powerful Filters add-on, you will be able to hide the table before filtering is applied.
Please check it out and let us know if you have any further questions.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
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
Is there a way to achieve this without editing plugin files? Maybe through a hook or filter? Thanks!
Update: I was able to find a solution using your 'wpdatatables_filter_table_description' filter. My only question now, is if there is a way to add an option to the admin edit table page as well, so that a default value of "2" rows can be set? Thanks!
Hi Dalton,
Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.
-
Aleksandar is on a Vacation, so I will take over this ticket.
We will share both methods with you, at the moment these are the only ways we have to change the 'default number of rows' at the table back-end settings, as well as the front-end, which you already figured out, via a hook wpdatatables_filter_table_description.
We don't have a built-in solution for this yet, but there is a workaround;
First for the front-end number of rows, by adding a hook to your active Theme or child Theme's functions.php file.
With this solution, it will not be affected by plugin updates
since it would pull the function from the Theme itself.
-
For example, if you need the same options for all tables,
add this hook: "wpdatatables_filter_table_description" to the active Theme's or child Theme's functions.php :
( This example removes the "ALL" option from the number of rows selection dropdown, but you can modify it to change/add options you need)
Or, if you just need it for one specific table, you can pass table ID, as a parameter of the function, like this :
( On that example, the table ID is 1, but you can set your table's ID)
-
Alternatively, if you wish to select multiple specific tables that should have this, you can add multiple table ID's, for example :
Important to note :
This hook is not going to change the options in the back-end table settings/Display settings, here the options will look the same :
But it will directly override the settings on the table itself, ( in both back and front-end),
so if we check on the table's available options for number of rows, it will then activate the hook's settings in the "Show Number of Entries" dropdown :
Of course, that was an example where we removed the "ALL" rows option,
but you can modify the hook, to change/add options you need.
-
Now, this other workaround is if you wish to change the available row options on the back-end of the table settings.
You also can't use this option out-of-the-box, but there's a way to do it.
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, then the exact line number changes,
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 option "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
Important to note :
During updates, this code will be overwritten, it will change to default code, so if you update the plugin, you have to repeat this process.
We will work on adding a better solution as soon as possible, for the time being, it is like that.
If you wish to affect the speed of development for these options,
Please feel free to search on our suggestions page,
to see if someone may be already suggested this feature. If you can't see it, feel free to add your suggestion there, and as more people vote, the feature will move higher on the priority list.
You can certainly follow our changeLog page if you'd like ( it is also available in the plugin dashboard), where we state any changes/new features/bug fixes during updates;
and our newsletter, so you're informed about new features, bug fixes, freebies, etc.
Let me know if that 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
Hey Miloš,
No worries! This should work fine for now.
Thanks!
Hi Milos
I followed your instruction, which works perfectly for my as well. I need 3 instead of 1 (3 medals).
As a suggestion for future updates: I would be helpfull to have the definition of selectbox row elements decided by the admin somewhere in the admin panel.
Best Regards Michael
By the way, in the filter for more than 1 table a "closed braket" is missing.
Hi Michael,
To begin, I want to extend my heartfelt apologies for the delayed reply,
which is due to an unexpectedly high volume of inquiries.
We truly value your patience during this period.
-
I am glad to see that the custom workaround has worked as intended for you as well, to edit the default rows per page options.
When it comes to the future update suggestion, to add this somewhere as built-in option on Back-End to edit/change to custom default options;
thank you, we appreciate it.
You can affect this development speed by voting/ or adding it for voting if it does not already exist on our development suggestions Page.
Please feel free to search on our suggestions page,
to see if someone may be already suggested this feature. If you can't see it, feel free to add your suggestion there, and as more people vote, the feature will move higher on the priority list.
You can certainly follow our changeLog page if you'd like ( it is also available in the plugin dashboard), where we state any changes/new features/bug fixes during updates;
and our newsletter, so you're informed about new features, bug fixes, freebies, etc.
I just did not understand your last reply - you wrote that there is a closed bracket missing if you filter for more than one table;
Would it be possible if you can open a new ticket and send us some screenshots/or a Video to elaborate a bit more on this issue - then we can try to reproduce it and see if it's a bug or just an error in the custom workaround?
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
Hi Milos
Thanks for your reply.
Here is a screenshot about the missing braket.
Best Regards Michael
Attached files: Screenshot 2024-02-29 104110.png
Hi Michael,
My apologies once again for all the time between the replies.
I can see exactly what you mean now, thank you for pointing this out - when i tested it in the Visual Studio Code Editor, it has highlighted that missing bracket with red color straight away;
we have somehow missed it, but corrected it now for the future.
Thanks again for pointing it out for us;
and for the future improvement suggestion to add the native option.
If anything else comes up, please don't hesitate to open new tickets.
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