sDom resets when using AJAX and multiple tables

sDom resets when using AJAX and multiple tables

DominicLDominicL Posts: 2Questions: 0Answers: 0
edited July 2013 in DataTables 1.9
Hi everyone

I've looked through the forum and haven't found anything similar to what I am experiencing right now (so far).

I want to use AJAX to load different tables formatted with DataTables in one page.

I have three div in my page (all loaded through AJAX from external pages):
- First one is my custom search box
- Second one is my first table (with length changing, table, pagination and information only)
- Third one is my second table (table only)

On the first load, everything is fine. But when I enter anything in the search box, the sDom of the second table is reset to the default one (with length changing, filtering, pagination, information)

Could someone help me find what I'm doing wrong?

Thank you

I've loaded a debug page and uploaded it to DataTables live.
Debug: http://debug.datatables.net/uwudun
Live: http://live.datatables.net/osokem/4

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    I don't know if this is the cause, but there's an extraneous semi-colon in your code for table 2

    [code]
    $('#table2').dataTable({"sDom": t;});
    [/code]

    right after the "sDom": t
  • DominicLDominicL Posts: 2Questions: 0Answers: 0
    edited July 2013
    Hi fbas

    Thanks for pointing this out but it isn't actually the error. While looking at this, I actually found out that the sDom value wasn't encapsulated in single quotes.

    Changing
    [code]
    $('#table2').dataTable({"sDom": t;});
    [/code]
    to
    [code]
    $('#table2').dataTable({"sDom": 't'});
    [/code]
    fixes the issue.

    Thanks
This discussion has been closed.