Weird issue with DataTables plugin

Weird issue with DataTables plugin

SuperfafaSuperfafa Posts: 1Questions: 1Answers: 0

Hi all

I'm facing a weird issue the jQuery "DataTables" plugin with (http://datatables.net/).

Here's my usecase. My page contains a menu and a div wrapping the main content. A click on a menu's option loads a page's content into the wrapper, using the jQuery load() function.

More concretely !
Let's say I have 2 menu option : "Show table 1" and "Show table 1", loading respectively two pages whose content is :

var columnsForTable1 = [ ... ];

$('#div-table-1').DataTable({ ajax: 'get-data-for-table-1.php', columns: columnsForTable1 });

and

var columnsForTable2 = [ ... ];

$('#div-table-2').DataTable({ ajax: 'get-data-for-table-2.php', columns: columnsForTable2 });

Now here's the issue :

  • after opening my browser and clicking on "Show table 1", the corresponding page loads and table 1 renders

  • after opening my browser and clicking on "Show table 2", the corresponding page loads and table 2 renders

  • BUT ! after opening my browser, clicking on "Show table 1", and then clicking on "Show table 2", I get an error. In fact the columns data passed to get-data-for-table-2.php are NOT columnsForTable2 as expected, but columnsForTable1 !

Any help would be gretly appreciated.

Answers

  • allanallan Posts: 63,679Questions: 1Answers: 10,498 Site admin

    Please provide a link to a test page showing the issue, as per the forum rules. We would need to be able to see the code to have any chance of being able to offer any help here I'm afraid.

    Allan

This discussion has been closed.