Comments 2Trent started the conversation2 days ago on Tuesday at 9:06amHi.I was trying to edit what options I have in the lengthMenu (items per page).I found the link to this: https://datatables.net/reference/option/languageAnd worked out how to add more by pasting this in the lengthMenu field under the Localization tab. 'Display <select>' + '<option value="10">10</option>' + '<option value="20">20</option>' + '<option value="50">50</option>' + '<option value="100">100</option>' + '<option value="150">150</option>' + '<option value="200">200</option>' + '<option value="-1">All</option>' + '</select> records' But found that I had to start with an option of 10, otherwise the first option would not be pre-selected.Ideally i would like to have: 'Display <select>' + '<option value="20">20</option>' + '<option value="50">50</option>' + '<option value="100">100</option>' + '<option value="150">150</option>' + '<option value="200">200</option>' + '<option value="-1">All</option>' + '</select> records'I am interested in perhaps a better explanation as to how to use the lengthMenu if i am not using correctly.And then perhaps an answer to why when 20 is the first option the select field is blank with no option pre selected.Attached files: Screen Shot 2024-11-05 at 7.35.12 pm.png 1,200Dustin replied22 hours agoHi Trent, Please also add the custom code below. (How to add custom code? ↗): add_filter( 'wpcvt_datatable_params_arr', function () { return [ 'pageLength' => 20 ]; } ); Then, the '20' option will be selected by default.Best regards,Dustin 2Trent replied22 hours agoYour solution worked.Perfect Dustin, thank you..!1 Like Sign in to reply ...
Hi.
I was trying to edit what options I have in the lengthMenu (items per page).
I found the link to this: https://datatables.net/reference/option/language
And worked out how to add more by pasting this in the lengthMenu field under the Localization tab.
But found that I had to start with an option of 10, otherwise the first option would not be pre-selected.
Ideally i would like to have:
I am interested in perhaps a better explanation as to how to use the lengthMenu if i am not using correctly.
And then perhaps an answer to why when 20 is the first option the select field is blank with no option pre selected.
Attached files: Screen Shot 2024-11-05 at 7.35.12 pm.png
Hi Trent,
Please also add the custom code below. (How to add custom code? ↗):
Then, the '20' option will be selected by default.
Best regards,
Dustin
Your solution worked.
Perfect Dustin, thank you..!