Okay
  Public Ticket #1256705
Moving info block to the top of the table
Closed

Comments

  •  2
    mks222 started the conversation

    Hi - how can I move the 'Showing X of X entries' (info block) to the top of the table?


    Many thanks.

  • [deleted] replied

    Hi mks222,
    Thank you for the purchase.

    Only way to move info block above the table is to edit plugin file. In file ../wp-content/plugins/wpdatatables/source/class.wpdatatable.php on line 2671 find:

    $obj->dataTableParams->sDom = "BT<'clear'>{$showRowsPerPage}{$globalSearch}{$scrollable}{$infoBlock}p";

    and replace it with:

    $obj->dataTableParams->sDom = "B{$infoBlock}T<'clear'>{$showRowsPerPage}{$globalSearch}{$scrollable}p";


  •  2
    mks222 replied

    perfect - thank you!  Any ideas on how not to overwrite when I update the plugin?

  • [deleted] replied

    Hi mks222,

    There is a solution not to overwrite this using filters. You can create your custom function that you have to add in function.php file of your theme.

    wpdatatables_filter_table_description( $object, $tableId )

    This filter is applied to an object (PHP’s StdObj), which is later printed as a table’s data attribute (json_encoded), and used to initialize the DataTables instance, and to describe other table settings and parameters that are used by the frontend JS library.

    $object is the PHP StdObj which contains all the necessary fields for initializing the table

    $tableId is the table identifier from the MySQL table (wp_wpdatatables)

  •  2
    mks222 replied

    thanks Milos - would I just paste that in functions as you wrote it? Or do I need to write a function calling wpdatatables_filter_table_description( $object, $tableId )? 


    Thanks.

  • [deleted] replied

    Hi mks222,

    You have to write function that will use this filter. You can add this function in function.php file of your theme.

  •  2
    mks222 replied

    great, thank you!