Okay
  Public Ticket #2003364
Having custom number rows
Closed

Comments

  • RFAWP started the conversation

    Is there a way we can get it to automatically show 12 rows on the monthly data and 52 rows on the weekly data, that would be preferable.  Right now it defaults to 10 on monthly and 25 on weekly.

  •  2,572
    Aleksandar replied

    Hello RFAWP.

    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 331 you'll see this:

    <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="25">25</option>
       <option value="50">50</option>
       <option value="100">100</option>
       <option value="-1"><?php _e('All', 'wpdatatables'); ?></option>
    </select>

    You can change the values "10" and "25" to "12" and "52" and you'll have that option in the "Display" tab above the table. See how I changed 25 to 30:

    6379747315.png

    I hope this helps.

    Best regards.

    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

  • RFAWP replied

    You're still missing additional code for me to insert, it's still only loading 10 items per page, but then have you switch to the last two items. We need them to make it 12 rows of data visible on one page

  •  2,572
    Aleksandar replied

    Hello again RFAWP.

    I am sorry, I forgot about "Showing XX entries" which can cause a conflict. 

    Like I said in the previous reply, you can add a couple of more lines of code to ../wp-content/plugins/wpdatatables/templates/admin/table-settings/table_settings_block.inc.php and around line 331, like this:

    <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 3092, 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 488 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.

    Best regards.

    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

  • RFAWP replied

    That coding worked great, thank you! However, now we are seeing arrow navigation below the table on the right. We'd like just the most recent up-to-date 12 rows and the rest hidden on the backend (so people can still download it on the excel option), but no arrow navigation, etc.

    Can you help?

  •  2,572
    Aleksandar replied

    Hello again RFAWP.

    You're welcome.

    When you say "arrow navigation", you mean this, right?

    8368701574.png

    If this is what you want to hide, then just add this code in Custom wpDataTables CSS under the “Custom JS AND CSS” in main settings of wpDataTables:

    .wpDataTablesWrapper .dataTables_paginate{display: none !important;}

    This will be affected on all tables, but if you want just for specific one then insert this code on the page where is that table between the style tag (<style>Code here</style>):

    <style>
    .wpDataTablesWrapper .dataTables_paginate{display : none !important;}
    </style>

    Best regards.

    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