FixedHeaders (v3.1.6): Any reference to original table?

FixedHeaders (v3.1.6): Any reference to original table?

foulkes7sffoulkes7sf Posts: 3Questions: 1Answers: 0

I have some custom header-level elements that have behavior that I would like to maintain on the fixed header. Does anyone know if the created fixed position table has any reference to the dataTable it originated from? I haven't noticed anything that consistently ties it to the table that created it, so far. Just want to make sure there isn't anything out-of-box that I'm missing before I create my own solution. Thanks in advance!
DataTable version: 1.10.20

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • foulkes7sffoulkes7sf Posts: 3Questions: 1Answers: 0

    Apologies, the question is generally about fixedHeaders so I didn't think a test case was necessary this time. The below link is essentially the situation I am dealing with.
    Take a checkbox column with a header level checkbox that is to be used as a 'select-all'. If I click the fixedHeader table's 'select-all' checkbox, I'm just wondering if that table contains any reference to the original, via some DT info or jquery data, etc?
    http://live.datatables.net/hurevice/1/edit?html,js,output

  • kthorngrenkthorngren Posts: 20,276Questions: 26Answers: 4,765

    The example does help because it makes it easier for us to show what is happening. If you inspect the selectAll checkbox in look for the parent table you will see it has the id of the original table. You can use something like this updated example to get the Datatable API for the table:
    http://live.datatables.net/haqewuye/1/edit

    I added the Select Extension just to show it works. Not sure if you are using it. If you do you can use this example for the checkboxes.

    Kevin

  • foulkes7sffoulkes7sf Posts: 3Questions: 1Answers: 0

    First of all, thank you both for your quick responses!

    The example you posted seems to have the exact issue I'm dealing with still (trying scrolling down before clicking the 'select-all'). I'm all set if we're interacting with the original table (my mistake for not making that clearer), but fixedHeader table's "select-all" doesn't maintain that functionality, which is reasonable. My current workaround is to basically have all my datatables create a "data-selector" attribute on their table element upon the init event, since the fixedHeader table seems to copy over pretty much the whole element except for the 'id' attribute.
    That workaround should work for me, as I typically have an Id set for any tables I'm going to need fixedHeaders for, but I think it would be really helpful for custom functionality if the fixedHeaders extension would retain a reference to the original table node, as my solution doesn't seem ideal. Let me know what you think or if I missed something in your example. Thanks again!

  • colincolin Posts: 15,142Questions: 1Answers: 2,586
    Answer ✓

    This is Kevin's example here, working with the table scrolled or unscrolled. There's not an easy way to determine whether you're in the FixedHeader or the standard table, so it needed a bit of tweaking of the attributes. Hope that helps,

    Colin

This discussion has been closed.