• Hello Support

    For some reason the crypto table is not always loading on my site, sometimes i hit refresh 2-3 times until I manage to load the table, I have installed the table on my home page.
    Keep getting this error (not sure if it has anything to do with your plugin):
    Uncaught TypeError: jQuery(…).DataTable is not a function
    at Object.success ((index):684)
    at i (jquery.js?ver=1.12.4:2)
    at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4:2)
    at y (jquery.js?ver=1.12.4:4)
    at XMLHttpRequest.c (jquery.js?ver=1.12.4:4)

    Please help me

    Thanks

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Nick12123

    (@nick12123)

    Hey if anyone is actually maintaining this plugin then throw an update with
    following code in cryptocurrency-prices/includes/currencyall.class.php
    basically added document ready function

    
    <script type="text/javascript">
    jQuery(document).ready(funcction(){
        //get list of currencies
    
        var toCurrency = \''.$base_currency.'\';
    
        var apiUrl = \'https://api.coinmarketcap.com/v1/ticker/?convert=\'+\''.$base_currency.'\'+\'&limit='.$limit.'\';
    
        console.log(apiUrl);
    
        jQuery.get( apiUrl, function( data ) {
    
          //prepare dataset for datatable
    
          var dataSet = [];
    
          for (var currentCurrency in data){
    
            //console.log(data[currentCurrency]);
    
            var name = data[currentCurrency].name;
    
            var rank = data[currentCurrency].rank;
    
            var price_number = data[currentCurrency][\'price_'.mb_strtolower($base_currency).'\'];
    
            //var price = price_number.toLocaleString('.$locale.')+\' \'+toCurrency;
    
            var price = price_number.toLocaleString('.$locale.');
    
            var supply = parseInt(data[currentCurrency].available_supply).toLocaleString('.$locale.');
    
            var volume = parseInt(data[currentCurrency][\'24h_volume_'.mb_strtolower($base_currency).'\']+\' \').toLocaleString('.$locale.');
    
            if (data[currentCurrency].percent_change_24h > 0){
    
              var changeClass = "change-inc";
    
            } else {
    
              var changeClass = "change-dec";
    
            }
    
            var change = "<span class=\""+changeClass+"\">"+data[currentCurrency].percent_change_24h+\'%\'+"</span>";
    
            var marketCap = parseInt(data[currentCurrency][\'market_cap_'.mb_strtolower($base_currency).'\']).toLocaleString('.$locale.');
    
            var image = "<img class=\"lazy\" data-src=\"'.CP_URL.'images/coins32x32/"+data[currentCurrency].symbol.toLowerCase()+".png\" style=\"max-width:20px;\" />";
    
            
    
            dataSet.push([rank, image+\' \'+name, marketCap, price, volume, supply, change]);
    
          }
    
          
    
          //show datatable
    
          jQuery(".cp-cryptocurrencies-table").DataTable({
    
            data: dataSet,
    
            columns: [{ title: "#" },{ title: "Coin" }, { title: "Market Cap, '.$base_currency.'" }, { title: "Price, '.$base_currency.'" }, { title: "Volume (24h), '.$base_currency.'" }, { title: "Circulating supply" }, { title: "Change (24h)" }, ],
    
            "order": [ [0, \'asc\'] ],
    
            "pageLength": '.$perpage.',
    
            "lengthMenu": [ [10, 50, 100, 500, 1000, -1], [10, 50, 100, 500, 1000, "All"] ],
    
            drawCallback: function() {
    
              var lazy = jQuery(".cp-cryptocurrencies-table img").Lazy({
    
                chainable: false,
    
                defaultImage: \'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAopSURBVHjajFddjF1VFf723ufcc+7/3JnpzHTKtNPSmlJpMURBIKIi8UGCLwIvmqiB+GBMjH8xRBJ9wRgTY3gw8UF8UF+MCUaJidEEDYlgJQiU0pZC6XRK53/m/t9zzzn7nO2395kWNMUwk5177/lZ69trfetba4sLf/omij8B5AlEvASVr0H5VUAPoGQEo7uQlSD0GvN3etXmJ2VYPaHK8oBQommQSWSil6dqLY+Gr6bt7nNpt/esEOkGShVkSQ6TC2RpChMsQicaUBP0lzuvHv7Pn8kyGIWZYO7QI+H83BdUs3yT9DNIL+XdESH3+RAdiDJ/l2/O89q9Ydr6hh6K9WR943dxu/czkw3OQfjv6eP6AEzh3G81H6ndOPUDv5ntU16HF9tIBgoRv8b9MXQ04kYyqDBFqZYinIgQNiSCCTHr18pfC6KpL40urj4RrXcehzHR+wNgBDela9XFiZ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zkqk1QyltmFU2SzP0ZzghNwOYenitneKXMiMOh5GEYllKcCNCjjWUzn7KDV2Rrq9QGBD9geBM5ePPyYkbLjMeWeIFOt1ozzqddOXTr+2EduPPlTP+mjFtL4/hbaSwxZP3VjWetACaMdibVVO2zogpBWk6gb1k55wsPEQjFHJJReQ/bX9tUxMRUhG/Bww8Hh3FvHnlrPbvm1V8vcGOHJoOKM+OTzhj72xKtL3buO33DqAUkHFc586sg0Q8/ZYGdIA7kbscpVj76tahaKJwngagvI4py84EzBCXpifxmVUg+63edAovHm2uK5Nzq3f8VjhxX51ZOReEdePSbkcnzbF+UVUzk6/fJnVJxyNxFmFiYxmqqjv8by6YzdJCyMudYjrnZlq3B+w0dzNkS1SfkdbSAleQW14eLm4oXXtu/8rCh52wLZ9Q8mtqaVJ0dL49sejFbLvzra/NfnKqUhUzBGEAYI52vQ8yEl1BKUpZruRsAXTjdKVXZQe2wbbyFbYwnSkWaHfbNz4tSF/q0PSCHekO9yft2TEUWYDSwbraTHH+y35757MPjno7PBckON2S92Bu5AEpR8lDm0IJTFSwynleV8I0ViRYqnppyC1I5n8dbotie3syPfgRjyaJO+z7OhFVKR8jA3+6PTo/v+8HZ86dtz6uxDk+pKLUjIhdHYUV/s9qbdIw4VRyIRIbr5PrOaHP3Llj78Y3jVZ9jynby//8PpNZvkqTRn29nBh3f0/scD0b2/Lrc+XRWbx0P0Z5SJAztJUzN1ktd2RnrqfC+beSYyrT9yCy9K5t6zfcG8t4//CDAAECtyy+agUVkAAAAASUVORK5CYII=\'                            
    
              });
    
              lazy.update(); 
    
            },
    
            responsive: true,
    
          });
    
        } );
    });
        </script>
    
Viewing 1 replies (of 1 total)
  • The topic ‘Shortcode no always load the table’ is closed to new replies.