Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter schiff7

    (@schiff7)

    Hi Tobias,

    Thanks for your reply and sorry for the delayed response.

    I appreciate that you taking the time to write me the code, but it seems that things still can’t function well yet.

    I checked the source code and found the following code in ‘controller-frontend.php’, around line 569:

    
    $render_options = apply_filters( 'tablepress_table_render_options', $render_options, $table );
    
    // Eventually add this table to list of tables which have a JS library enabled and thus are to be included in the script's call in the footer.
    if ( $render_options['use_datatables'] && $render_options['table_head'] && count( $table['data'] ) > 1 ) {
        // Get options for the DataTables JavaScript library from the table's render options.
        $js_options = array();
        foreach ( array(
            'alternating_row_colors',
            'datatables_sort',
            'datatables_paginate',
            'datatables_paginate',
            'datatables_paginate_entries',
            'datatables_lengthchange',
            'datatables_filter',
            'datatables_info',
            'datatables_scrollx',
            'datatables_scrolly',
            'datatables_locale',
            'datatables_custom_commands',
        ) as $option ) {
            $js_options[ $option ] = $render_options[ $option ];
        }
        (etc...)
    }
    

    Then I updated the $render_options['custom_commands'] to $render_options['datatables_custom_commands'] and saw my code rendered on the page.

    Should the $render_options['custom_commands'] be $render_options['datatables_custom_commands']?

    Thanks again for your help.

    Regards,
    Schiff7

    • This reply was modified 3 years, 11 months ago by schiff7.
    Thread Starter schiff7

    (@schiff7)

    Hi,

    Thanks for your reply.
    I have read the document of the DataTables JavaScript library, and would like to filter the table data on the fly via javascript, which need me to access the DataTable javascript object.
    The scripts that run on the page are surrounded by jQuery(document).ready(...), so I only can add an initComplete option to the Custom Command to access the DataTable javascript object and write my own scripts.

    Regards,
    Schiff7

Viewing 2 replies - 1 through 2 (of 2 total)