Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataTables error if multiple tables are loaded from different functions #411

Closed
wynstep opened this issue Jun 20, 2017 · 6 comments
Closed
Labels

Comments

@wynstep
Copy link

wynstep commented Jun 20, 2017

Hello everyone,
I ask help for a bug I cannot solve. At the moment I call a function to create a DataTable with the respective yadcf associated

function LoadPapersTable() {
var papersTable = $('#papers').DataTable( {
"order": [[ 4, "asc" ]],
"processing": true,
"serverSide": false,
"ajax": {
"url":"scripts/server_processing_literature.php",
"type":"post"
},
"columnDefs": [
{
"targets": [ 5 ],
"visible": false
},
]
});

yadcf.init(papersTable, [{
  column_number: 3,
  filter_type: "range_date",
  date_format: "yy-mm-dd",
  filter_container_id: "pubdate_filter",
  filter_plugin_options: {
    changeMonth: true,
    changeYear: true
  }
},
{
  column_number: 1,
  filter_type: "text",
  filter_container_id: "kw_filter",
},
{
  column_number: 5,
  filter_type: 'multi_select',
  select_type: 'select2',
  text_data_delimiter: ',',
  filter_container_id: 'test',
}]);`

Then, I call another function:
function LoadEstimateDataTable() { var estimate = $("#estimate").DataTable(); }

Despite on loading the second table the search bar and the style seems okay (Datatables loaded), nothing is working. The table is not searchable, sortable or no pagination appear, except when I change the number of visualised items (10, 25,100)

In the browser the error says
TypeError: obj.table is not a function. (In 'obj.table()', 'obj.table' is undefined)

Could you please help me? Thank you

UPDATE The bug appears just when I put "range_date" as filter of the DataTable

@vedmack
Copy link
Owner

vedmack commented Jun 20, 2017

Hi,

Please provide a link to a test case

@wynstep
Copy link
Author

wynstep commented Jun 24, 2017

http://jsfiddle.net/wynstep/fxntzdsu/

This is a working example of the bug

The bug is affecting also "multiselect_cust_fun"

Thank you! I hope you fix it soon ;-)

@vedmack
Copy link
Owner

vedmack commented Jun 25, 2017

@wynstep your test file won't load, you can paste it into the javascript box in jsfiddle or place it on some other domain / public hosting

@wynstep
Copy link
Author

wynstep commented Jun 25, 2017

@vedmack sorry, my server went down. I don't know why but functions does not work into the javascript box in jsfiddle. In any case, when it will go up again, the bug is reproduced!

Thanks

@vedmack
Copy link
Owner

vedmack commented Jun 25, 2017

@wynstep i fixed up your jsfiddle test page (your js was lacking some brackets and you did not include the jquery ui js/css)

and beside that everything works just fine, see here:

so I dont see any thing wrong here... please provide a steps to reproduce your issue with a working test page

@wynstep
Copy link
Author

wynstep commented Jun 25, 2017

http://jsfiddle.net/wynstep/fxntzdsu/

Okay, thanks for the suggestion. Now this version has the bug inside. It could be something related to the jquery version?
The bug does not appear with an old version, the latest creates the bug.

@vedmack vedmack added the bug label Jun 25, 2017
vedmack added a commit that referenced this issue Jun 25, 2017
@vedmack vedmack closed this as completed Jun 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants