Search code examples
wordpresshandsontable

Include handsontable in wordpress plugin


I would like to add a handsontable to a plugin which I#m currently trying to develop for WordPress. The table shall be visible in the Admin dashboard.

I could not manage to display the table at all.

Is there a general obstacle running handsontable in Wordpress?

Many thanks in advance


Solution

  • have you bound your .js file with the proper method ( wp_register_script and wp_enqueue_script )?.

    You should do it like this:

    // Registering the back-end scripts
    add_action( 'wp_enqueue_scripts', 'my_backend_content_scripts' ); 
    
    
    // ! Calling the back-end scripts 
    
    function my_backend_content_scripts(  ) {
    
            if( is_admin() ){ 
                // parameter ( name, script_url, depencys, version, include in header )
                wp_register_script( 'my_js', 'www.fullscript_url.com/handsontable.js', array('jquery'), null, true );  
                wp_enqueue_script( 'my_js');                
    
            }       
    
    }