More than one tables on page and getting the reference to first table

More than one tables on page and getting the reference to first table

mahinkhanmahinkhan Posts: 4Questions: 2Answers: 0
edited October 2016 in Free community support

http://jsfiddle.net/mahinkhan/Lz17rdme/

When I try to refresh the table I don't get correct url. So I get the question:

is this not the right way to get a reference to the first table?

$($('table.dataTable')[0]).DataTable().ajax.reload(null, false);

It appears that as the function is looping through tables and initializing them it corrupts the 'url' value of previous tables and reference to only last table remains intact.

I tried saving the reference of each table in an array that also didn't work

Answers

  • mahinkhanmahinkhan Posts: 4Questions: 2Answers: 0

    I found out the issue. It was because my tables' html was generated dynamically and they had the same IDs

  • allanallan Posts: 61,726Questions: 1Answers: 10,109 Site admin

    Thanks for posting back - good to hear you've got a solution!

    Allan

This discussion has been closed.