Okay
  Public Ticket #2455397
Showing X Entries
Closed

Comments

  • Adam Gough started the conversation

    Hi,

    I use the "show X entries" per page, but the maximum number is 100, or ALL.

    I would like to be able to select more entries, but not all. All is too many, 100 is too few. 1000 is a good maximum number.

    I can limit the number of data returned by editing the SQL query, but this is no use because I cannot move through the pages to see more results.

    How can I change the number of results per page to be a higher number?

  •  2,507
    Aleksandar replied

    Hello Adam

    You can add or modify some lines of code in ../wp-content/plugins/wpdatatables/templates/admin/table-settings/table_settings_block.inc.php and around line 335. I'll show you an example how to add 12 and 52 in the list, and you can modify the code:

    <select class="form-control selectpicker" id="wdt-rows-per-page">
       <option value="1">1</option>
       <option value="5">5</option>
       <option value="10">10</option>
       <option value="12">12</option>
       <option value="25">25</option>
       <option value="50">50</option>
       <option value="52">52</option>
       <option value="100">100</option>
       <option value="-1"><?php _e('All', 'wpdatatables'); ?></option>
    </select>
    

    This adds "12" and "52" in the Display tab above the table:

    3275252088.png

    Then, open ../wp-content/plugins/wpdatatables/source/class.wpdatatable.php and around line 3207, add "12" and "52", so it looks like this:

    $obj->dataTableParams->aLengthMenu = json_decode('[[1,5,10,12,25,50,52,100,-1],[1,5,10,12,25,50,52,100,"' . __('All', 'wpdatatables') . '"]]');
    

    And the last thing to do is to go to line 498 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, -1))) {
                return false;
            }
    

    So, again, you only need to add "12" and "52".

    This should work just fine.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia 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