Okay
  Public Ticket #2700591
chart shortcode not working
Closed

Comments

  • Matt started the conversation

    I can get a data table to appear using shortcode (as you can see in the link above) but when I use a shortcode for a chart, only a blank space appears on the front-end. You can see the blank area below the data table on that page.

    I'm using 1.4.1 and the field is an Advanced Custom Field WYSIWYG field.

  • [deleted] replied

    Hi Matt

    Thank you for reaching out to us.

    If the version of wpDataTables you are using is 1.4.1 we cannot provide support until you update to the newest version which is 3.4.1, you can try the solution below but we cannot guarantee it will work for your version.

    If you have the option Follow table filtering enabled, please follow the instructions below.

    In file wp-content/plugins/wpdatatables/source/class.wpdatachart.php on line 2706 you will find this

     if ($this->getFollowFiltering()) {

    add this code on end of that if statment

     if (get_option('wdtIncludeBootstrap') == 1) {
                    wp_enqueue_script('wdt-bootstrap', WDT_JS_PATH . 'bootstrap/bootstrap.min.js', array('jquery', 'wdt-bootstrap-select'), WDT_CURRENT_VERSION, true);
                } else {
                    wp_enqueue_script('wdt-bootstrap', WDT_JS_PATH . 'bootstrap/noconf.bootstrap.min.js', array('jquery', 'wdt-bootstrap-select'), WDT_CURRENT_VERSION, true);
                }
                wp_enqueue_script('wdt-bootstrap-select', WDT_JS_PATH . 'bootstrap/bootstrap-select/bootstrap-select.min.js', array(), WDT_CURRENT_VERSION, true);
                wp_localize_script('wdt-wpdatatables', 'wpdatatables_settings', WDTTools::getDateTimeSettings());
                wp_localize_script('wdt-wpdatatables', 'wpdatatables_frontend_strings', WDTTools::getTranslationStrings());

    So your code will look like this:

    if ($this->getFollowFiltering()) {
                wp_enqueue_script('wdt-common', WDT_ROOT_URL . 'assets/js/wpdatatables/admin/common.js', array('jquery'), WDT_CURRENT_VERSION, true);
                if ($minified_js) {
                    wp_enqueue_script('wdt-wpdatatables', WDT_JS_PATH . 'wpdatatables/wdt.frontend.min.js', array('wdt-common'), WDT_CURRENT_VERSION, true);
                    wp_localize_script('wdt-wpdatatables', 'wdt_ajax_object', array('ajaxurl' => admin_url('admin-ajax.php')));
                } else {
                    wp_enqueue_script('wdt-datatables', WDT_JS_PATH . 'jquery-datatables/jquery.dataTables.min.js', array(), WDT_CURRENT_VERSION, true);
                    wp_enqueue_script('wdt-funcs-js', WDT_JS_PATH . 'wpdatatables/wdt.funcs.js', array('jquery', 'wdt-datatables', 'wdt-common'), WDT_CURRENT_VERSION, true);
                    wp_enqueue_script('wdt-wpdatatables', WDT_JS_PATH . 'wpdatatables/wpdatatables.js', array('jquery', 'wdt-datatables'), WDT_CURRENT_VERSION, true);
                }
                if (get_option('wdtIncludeBootstrap') == 1) {
                    wp_enqueue_script('wdt-bootstrap', WDT_JS_PATH . 'bootstrap/bootstrap.min.js', array('jquery', 'wdt-bootstrap-select'), WDT_CURRENT_VERSION, true);
                } else {
                    wp_enqueue_script('wdt-bootstrap', WDT_JS_PATH . 'bootstrap/noconf.bootstrap.min.js', array('jquery', 'wdt-bootstrap-select'), WDT_CURRENT_VERSION, true);
                }
                wp_enqueue_script('wdt-bootstrap-select', WDT_JS_PATH . 'bootstrap/bootstrap-select/bootstrap-select.min.js', array(), WDT_CURRENT_VERSION, true);
                wp_localize_script('wdt-wpdatatables', 'wpdatatables_settings', WDTTools::getDateTimeSettings());
                wp_localize_script('wdt-wpdatatables', 'wpdatatables_frontend_strings', WDTTools::getTranslationStrings());
            }

    I hope this helpssmile.png 

  • Matt replied

    Hi Blaženka,

    You are right - I'm using version 3.4.1. Can you explain what you mean by "Follow table filtering"?

    I did make the modification and there was no change to the output. Any table shortcode I enter results in a plain HTML table with no formatting (image attached) when they're in Advanced Custom Fields WYSIWYG editor fields, and no chart shortcode I enter will display a chart when they're in Advanced Custom Fields WYSIWYG editor fields.

    Does wpDataTables not support Advanced Custom Fields?

    Thanks!

  • [deleted] replied

    Hi Matt

    Follow table filtering is an option in our chart wizard, you can read more about it's features following this link.

    Could you try it once more with the Follow table filtering enabled and let me know if it works?

  • Matt replied

    Hi Blaženka, that almost worked! Now if I insert 1 chart, the chart appears. When I enter 2 charts, neither chart appears. We're getting close! Do you have any further advice?

  • Matt replied

    After looking into this further it looks like Google Charts has an issue. Here's the error message from my console.

    jquery.min.js?ver=3.5.1:2 Uncaught TypeError: Cannot read property 'DataTable' of undefined
        at Object.render (wdt.googleCharts.min.js?ver=3.4.1:4)
        at HTMLDocument.<anonymous> (wdt.chartsRender.min.js?ver=3.4.1:5)
        at e (jquery.min.js?ver=3.5.1:2)
        at t (jquery.min.js?ver=3.5.1:2)


  • [deleted] replied

    Hi Matt

    Thank you for reaching out to us.

    Please provide me a temporary WP-admin login for your site where this happens, so we could log in and take a look ‘from the inside’ as that’s the most efficient way to see and resolve the issue. We do not interfere with any data or anything else except for the plugin (in case that’s a production version of the site), and of course we do not provide login data to third party. You can write credentials here just check Private Reply so nobody can see them except us.

  •   Matt replied privately
  • [deleted] replied

    Hi Matt

    Issues like this usually occur when there is a conflict either with the theme currently active on your website, or another plugin you have installed.

    Can you please change the theme and see if the issue is resolved? If not, then please deactivate all other plugins except for our plugin, refresh the page where the issue is, and see if it is resolved (it should be). If it is, then start activating other plugins one by one, and after each activation refresh the page to see if the issue reoccurred. Once it does reoccur, you will have found the plugin causing the issue.

  • [deleted] replied

    Hi Matt

    Have you managed to resolve the issue? I spoke to our developers about this and they suggested updating to the new version and clearing your server and browse cache.

    Do let us know if there is anything else we can do.