• Resolved neilgee

    (@neilgee)


    Hi,
    I am trying to use selectize js on TablePress select field but it is not applying – i think I need my js to load after TablePress but when I set to a priority of many 9’s I cannot load my js after TablePress.

    Is there a better way?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for your question, and sorry for the trouble.

    I’m not sure which select field you mean here. Can you please post a link to the page with the table where this problem happens, so that I can take a direct look? Thanks!

    Regards,
    Tobias

    Thread Starter neilgee

    (@neilgee)

    The select field that shows x number of entries just above table on left http://cranlana.org.au/advanced-symposia/

    Thread Starter neilgee

    (@neilgee)

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    ok, I see. I’m sure what the JS library can help with on that select box, but from what I can see, you’ll need to make sure that it runs after the DataTables JS.

    For that, you could maybe experiment with running your code after a short delay (using setTimeout in your JS code), or by enqueuing it in the hook wp_print_footer_scripts with a priority bigger than 11.

    Regards,
    Tobias

    Thread Starter neilgee

    (@neilgee)

    Thanks Tobias.

    Thread Starter neilgee

    (@neilgee)

    This is the code I used if anyone finds helpful…

    
    add_action( 'wp_print_footer_scripts', 'selectjs_table', 12 );
    
    function selectjs_table() {
        ?>
        <script>
            jQuery(document).ready(function($) {
    
                $('.dataTables_length select').selectize({
                    create: true,
                    sortField: 'text'
                });
                
            });
        </script>
    
        <?php
    }
    
    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    nice! Good to hear that you found a solution!

    Best wishes,
    Tobias

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

The topic ‘SelectizeJS on Dropdown’ is closed to new replies.