Love this module but have recently run into a problem.

One of my tables is being pulled into a panel via views. When I navigate to the panel page, the table does not appear. When I dig into the panel page admin (via the PageManager, if anyone is familiar with panels), I get the following error:

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

To retrieve the DataTables object for this table, pass no arguments or see the docs for bRetrieve and bDestroy

I'm at a loss. Can anyone point me in the right direction?

CommentFileSizeAuthor
#8 cannot_reinitialise-1842714-8.patch491 bytesevilehk

Comments

liminu’s picture

same error with drupal 7 version, any fix?

liminu’s picture

Assigned: Unassigned » liminu
Status: Active » Needs review

Find the solution (it's not a true solution, but works).

On jquery.dataTables.js in DataTables/media/js on line 4584 comment alert( sAlert );.

silurius’s picture

#2 solution appears to be D6 only. Same issue here under D7.

robinmofo’s picture

Does it only occur when using a 'panel_pane' view display?

I tried using a normal view page and it was fine on D7 but I do have a modified version of datatables.

Also, is your datatables plugin up to date?

robinmofo’s picture

The change in #2 only stops the error message from being displayed and hacks the original jquery plugin, it does not fix the problem itself and you are strongly advised against following that advice.

This error is telling you that you're initializing the plugin code twice, and that any subsequent calls to dataTable() should not contain any settings.

Can you share your datatables settings? (i.e. what you select under the style options) which should help us reproduce the issue.

ricksen’s picture

Issue summary: View changes

The easiest way - to change output of
return 'datatable-' . ++$datatable_id;
to
return 'datatable-' . ++$datatable_id+rand(1,10);
in datatables.module

silurius’s picture

Version: 6.x-1.1 » 7.x-1.2
Priority: Normal » Major

A year later, I've come back to this module and saw that this still hasn't been fixed. Anyone willing to roll a patch? (It's a bit beyond me.)

evilehk’s picture

Assigned: liminu » Unassigned
StatusFileSize
new491 bytes

I was receiving the same message on one of my sites using datatables. I followed the suggestion on http://datatables.net/manual/tech-notes/3 under "Object instance retrieval" to resolve. The patch is attached. It should be noted that while the issue was happening consistently before the patch was applied, I am not able to reproduce the message on a fresh Drupal 7 install.

uceap-web’s picture

applying the patch conflicts with admin_menu (not displayed).

cmanalansan’s picture

Status: Needs review » Reviewed & tested by the community

Seems to work fine for me with admin_menu. Steps to reproduce

  1. Go to https://simplytest.me/
  2. Project = datatables 7.x-1.2
  3. Click 'Add an additional project'
  4. Enter 'admin_menu'
  5. Apply patches = https://www.drupal.org/files/issues/cannot_reinitialise-1842714-8.patch
  6. Create the sandbox
  7. On the new sandbox, login (as admin)
  8. Click 'Modules'
  9. Check the box for 'Administration Menu' and Save Configuration
  10. Close the Modules overlay
  11. Verify that the admin menu appears
dqd’s picture

Version: 7.x-1.2 » 7.x-2.x-dev
Status: Reviewed & tested by the community » Needs review

The patch is 2 years old. Can somebody into D7 please chime in an confirm that this patch needs no reroll and still works fine with latest 7.x-2.x-dev? If we can keep it RTBC with some reviews I will try to commit asap. But some more uptodate user reviews would be very helpful.

dqd’s picture

+++ b/js/datatables.js
@@ -22,7 +22,7 @@
-  var datatable = $(selector).dataTable(settings);
+  var datatable = $.fn.dataTable.fnIsDataTable(selector) ? $(selector) : $(selector).dataTable(settings);

#9: Hard to believe that this code changes conflict with admin menu visibility...

dqd’s picture

~/datatables (7.x-2.x)
$ git apply -v cannot_reinitialise-1842714-8.patch
Checking patch js/datatables.js...
Applied patch js/datatables.js cleanly.

Seems still to apply. Great. Let's move on.

  • diqidoq committed d52f19a on 7.x-2.x authored by evilehk
    Issue #1842714 by evilehk, diqidoq, cmanalansan: Cannot reinitialise...
dqd’s picture

Status: Needs review » Fixed

Thank @all!

dqd’s picture

Status: Fixed » Closed (fixed)
joelpittet’s picture

@diqidoq you can leave it as "Fixed", it will auto-close in 2 weeks and gives a nice way to find recent changes.

dqd’s picture

Status: Closed (fixed) » Fixed

Oh. sure, no problem. I usually leave it as fixed but I am a lil' bit overly eager with rushing/fetching the long staying issues of DataTables at the moment. (accumulated demand)

It's hard for my momentary issue cleaning neurosis, ... but I will do it ... :)
... I ... will ... do ... it :) ...

PS: I see you are maintainer of VBO, can you have a look into the VBO implementation issue for me? (tagged) Thanks!

joelpittet’s picture

It's nice to see activity in the queue. thank you for your neurosis:) .

Which issue are you referring to for or on VBO queue? I didn't see you following any issues in that queue. I'll see if I can help

joelpittet’s picture

dqd’s picture

@joelpittet: Yes! :) Thanks for looking for it and sorry for missing the link, I was in a rush yesterday and after 10 hours in the issue queue my eyes were squinting. o.O ... (I am afraid that this won't happen VBO <> DT) but who knows ... )

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.