Drupal 8 - DataTables wanring (table id = 'datatable'): Cannot reinitialise DataTable

Drupal 8 - DataTables wanring (table id = 'datatable'): Cannot reinitialise DataTable

bavramorbavramor Posts: 1Questions: 1Answers: 0
edited January 2020 in Free community support

I always get the following error. I press okay and still everything seems to work so far.

DataTables wanring (table id = 'datatable'): Cannot reinitialise DataTable

To retrieve the DataTables object for this table, pass no arguments or see the docs for bRetrieve and bDestroy
I always get the following error. I press okay and still everything seems to work so far. I have seen that Drupal 7 has a patch for this error. There is also a patch for Drupal 8.

In the documentation of the datatables plugin I found the following:

https://datatables.net/manual/tech-notes/3

But where to put it. Thanks for your help.

**my datatables.js
**

     /*
       * Support functions to provide a little bit of 'user friendlyness' to the textboxes in
       * the footer
       */
    var asInitVals = new Array();
    
    jQuery(document).ready(function() {
      var oTable = jQuery('#datatable').dataTable({
        paging: false,
        searching: false,
        "oLanguage": {
          "sSearch": "Search all columns:"
        }
      });
    
      jQuery("thead input").keyup(function() {
        /* Filter on the column (the index) of this element */
        oTable.fnFilter(this.value, jQuery("thead input").index(this));
      });
    
    
    
      /*
       * Support functions to provide a little bit of 'user friendlyness' to the textboxes in
       * the footer
       */
      jQuery("thead input").each(function(i) {
        asInitVals[i] = this.value;
      });
    
      jQuery("thead input").focus(function() {
        if (this.className == "search_init")
        {
          this.className = "";
          this.value = "";
        }
      });
    
      jQuery("thead input").blur(function(i) {
        if (this.value == "")
        {
          this.className = "search_init";
          this.value = asInitVals[jQuery("thead input").index(this)];
        }
      });
    });

Edited by Kevin:  Syntax highlighting. Details on how to highlight code using markdown can be found in this guide

Answers

This discussion has been closed.