scrollX and scrollY remove table id

scrollX and scrollY remove table id

adjenksadjenks Posts: 22Questions: 6Answers: 0
edited February 2017 in Free community support

Similar to the problem that this individual faced, I am running into issues with scrollX and scrollY options:
https://datatables.net//forums/discussion/17238
I find that accessing and modifying the table by the id doesn't work very well under some circumstances, the id seems to disappear or is behaving like a different element or something.
I've linked an example here:
http://live.datatables.net/xoxixixo/4/edit ( I updated the example, it is a bit more clear now )
The same problem occurs within the thead elements, id's tags are removed and are no longer referenceable after some time.
Let me know what you think,
Andrew

This question has an accepted answers - jump to answer

Answers

  • adjenksadjenks Posts: 22Questions: 6Answers: 0

    Here is another discussion that was not responded to regarding the same issue:
    https://datatables.net//forums/discussion/17449

  • adjenksadjenks Posts: 22Questions: 6Answers: 0

    Here is another user that had the issue:
    https://datatables.net//forums/discussion/36271

  • adjenksadjenks Posts: 22Questions: 6Answers: 0

    I updated the example link, it was a bit unclear before.
    Anyone take a look at this yet?

  • queen833queen833 Posts: 1Questions: 0Answers: 0

    +1 This is a very big problem for me too.

  • allanallan Posts: 63,356Questions: 1Answers: 10,447 Site admin
    Answer ✓

    When you enable scrolling in DataTables, the table is split into two sections (or three if you have a footer) - the header and the body. The body is the original table element and retains the ID, which you will be able to see if you "Inspect" the body part of the table.

    In the example links, the table does turn green, but the colouring of the rows and cells are layered on top of that. If you make those element transparent you can see that: http://live.datatables.net/xoxixixo/6/edit .

    If you need the header and body, you can use the table().header() and table().body() methods.

    Allan

  • adjenksadjenks Posts: 22Questions: 6Answers: 0

    Thank you Allan,

    That makes things more clear.
    I think most people don't expect this behavior, as can be seen by the multiple forum posts about it. I actually recently found another one:
    https://datatables.net//forums/discussion/36930
    That makes 5 reported struggles with this side effect, that I have found.
    Therefore I believe that this behavior should be documented more clearly on the scrollX page to save people's time if possible.
    Would it be possible for someone to do this?

    Thank you,
    Andrew

  • adjenksadjenks Posts: 22Questions: 6Answers: 0

    You actually responded to that post as well. I wish I had found that one earlier but I didn't for some reason.

  • allanallan Posts: 63,356Questions: 1Answers: 10,447 Site admin

    I think most people don't expect this behavior, as can be seen by the multiple forum posts about it.

    I totally agree - it isn't what people expect. And I don't want to have to do it that way. But I don't technically know of any other way of doing it.

    Allan

This discussion has been closed.