Okay
  Public Ticket #1691420
Callbacks
Closed

Comments

  •  6
    cpshart started the conversation

    Hi 

    I am trying to use the callback feature to make a change to the wpDataTablesChart for charts.js. e.g. change the chart colour

    and changing the chart number to 12 for my chart. as follows

    <script> jQuery(window).load(function() {     

    if (typeof wpDataChartsCallbacks == 'undefined') 

    {         wpDataChartsCallbacks = {};     }     

    wpDataChartsCallbacks[2] = function(obj) {         obj.options.chart.backgroundColor = '#F7F7F7';         

    obj.options.plotOptions = {             

    series: {                 

    dataLabels: {                     

    enabled: true,                     

    color: '#FF0000'                

    }             

    }         

    }     

    } });

    </script>

    [wpdatachart id=12]

     

    hopefully an easy answer, am I inserting the JS code in the correct place namely just after or before the shortcode [wpdatachart id=12] within my elementor accordion.

    Placing the code before or after the above shortcode simply displays the JS code on the page, so is not executing, should the JS code be placed elsewhere in my system ??


    Many Thanks

    Colin


  •  471
    Isidora replied

    Hi Colin,
    Thank you for your purchase.

    All you have to do is take the code and paste it in your Text Editor. If you are using some page builder or anything else that is not standard wordpress Text editor you have to find option how to insert javascript on that page or to contact support of that plugin to find out how to achieve this.

    When you find this we notice that id of the chart are not the same in wpDataChartsCallbacks and in shortcode which can cause not applying changes that you made with this callback. You can find examples of wpdatachart callbacks in our Support Help Center.

    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables

  •  6
    cpshart replied

    Hi Milan

    Many thanks for your quick reply, good advice re the ID, I had assumed they were the same !!, I will explore my options of calling javascript within my environment namely latest versions of

    Wordpress

    Generatepress Pro Theme

    Elementor Page Builder

    wpDatatables, wpDataCharts plugins

    Best Regards


    Colin

  •  471
    Isidora replied

    Hi Colin,

    We are not familiar with Elementor Page Builder but I suppose that they have option that you can insert javascript code on page. I believe that you will find that option.

    Best regards.

    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables

  •  6
    cpshart replied

    Hi Milan

    I have looked at your support pages which are very helpful.

    I believe you simply paste the JS code and wpDataCharts shortcode into an HTML Widget on the page, which I have just done a test below and although there are no errors it is not responding to in this case displaying the title Test Chart Title

    Contents of HTML Widget within Elementor

    <script type="text/javascript">

    jQuery(window).load(function(){
        if( typeof wpDataChartsCallbacks == 'undefined' ){ wpDataChartsCallbacks = {}; }
        wpDataChartsCallbacks[12] = function(obj){
            obj.options.plotOptions = {
                series: {
                         dataLabels: {
                            enabled: false
                         }
                },
                title: {
                    display: true,
                    text: 'Test Chart Title'
                }
            };
        };
    });
    </script>

    [wpdatachart id=12]

    I will continue to test ..

    Thanks Colin



  •  471
    Isidora replied

    Hi Colin,

    I am glad that you find usuful informations in our new Support help center.

    For future testing some advices: 

    • Please note that using hooks or wpdatatable or wpdatachart callbacks requires certain level of programing skills and included support refers only to advices.
    • Every chart exposes several options that customize its look and feel. Charts usually support custom options appropriate to that visualization. wpdatachart callbacks  allows adding options that are available in Google Charts API, Highcharts API and Chart.js API
    • All necessary rescuers are available in charts engines API(depends which one you use) .Every engine have different approach of charts settings. In wpdatachart callbacks you have to adopt those settings to wpdatachart object(you can take a look a examples for each engine in our documentation and also in Support help center). Huge number of examples for any area of programming you can find on stackoverflow.com(typing your problem in google and of the end add site:stackoverflow.com and google will search only on that website) and also a lot of resource of examples of chart, chart settings and customisations you can find on jsffidle. net(typing in google for example line chart highcharts jsffidle)

    Best regards.

    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables

  •  6
    cpshart replied

    Hi Milan

    Some good advice thanks, I will take a look at these other resources before submitting a ticket in future, I already use stackoverflow.com, a great resource.

    My most important use of callbacks is in another area but critical to the success of my website, I will describe it briefly as follows :- 

    I have a sorder table for direct debits of the form

    id, 1

    code, SWW

    name, south west water

    frequency, monthly

    date_from, 31/09/18

    date_to, 31/07/19

    amount, £300

    After the INSERT of this row I need to trigger a procedure or callback to write the corresponding rows for each month to a sorder_line table as follows :-

    date, sorder_id, £300

    31/09/18, 1, £300

    31/10/18, 1, £300

    until

    31/07/19

    I have written a procedure to perform this activity and it works, but I don't believe I can call this procedure using wpDataTables, so I need a callback or hook to do this automatically after an INSERT of a wpDataTable row of the MySQL sorder table.

    If you can provide an indication of how I can trigger either my procedure or configure another method that would be appreciated. Also shall I raise this as another call, many thanks.


    Best Regards

    Colin



  •  471
    Isidora replied

    Hi Colin,

    You can't use procedures directly in our MYSQL query box, but you can take a look in our documentation  about Actions and Filters which are defined in wpDataTables plugin for customization's by developers.

    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables

  •  6
    cpshart replied

    Hi Milan

    Thanks for your reply, I will see if it is possible to achieve my objectives using the actions and filters and post my results, likely over the weekend.

    Best Regards

    Colin


  •  471
    Isidora replied

    Hi Colin,

    You are welcome.

    Best regards.

    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables