Date range inside loop of multiple datatable in the same page

Date range inside loop of multiple datatable in the same page

gcc_andregcc_andre Posts: 4Questions: 2Answers: 0

I came from the issue [https://datatables.net/forums/discussion/51949/looping-multiple-datatables-on-the-same-page#latest] and found a new one that comes from filtering of dates: if I filter and on change of this date range, it triggers table.draw() but in console it triggers not defined if it us inside of the loop of multiple datatable in the same page

Also, would like to know how to add ajax data without need to declare its columns (in my project, I have enough columns for the front end already declared and the ajax already structured)

http://live.datatables.net/magokusa/1/edit

Answers

  • colincolin Posts: 15,236Questions: 1Answers: 2,598

    Hi @gcc_andre ,

    The problem here is to your other thread - you're reusing the same IDs for both tables. Here, you have two pairs of input elements which have the same ID in the DOM, which is illegal HTML - they have to be unique. Also, the search function is only using one set - it wouldn't know about the set for the other table.

    Regarding Ajax, if you're passing objects, then it needs to be defined. You can however pass arrays as in this example here.

    Cheers,

    Colin

  • gcc_andregcc_andre Posts: 4Questions: 2Answers: 0

    Got it, I've edited the link (http://live.datatables.net/magokusa/4/edit) till the point I could not advance:

    • I could not make the filter go differently to each table
    • In another occasion, when the date range filter changed, the table was shared by both tables so it could not filter also so when it was executing .draw, it tried to filter only the last table
This discussion has been closed.