ColVis + fixedColumns

ColVis + fixedColumns

mbaasmbaas Posts: 67Questions: 24Answers: 1

I would like to use both extensions together with a very simple challenge: just keep the leftmost column, a very small one, in a fixed position. Now...the compatibility-chart seems to suggest there might be problems, whereas this page does not mention there are issues to be expected. So I don't know if I have hit a case of "told you so" or whether it is a bug:

Unfortunately there is a problem with the intialisation of the table which seems to be all messed up. If I enable additional columns after init, the table gets redrawn and is formatted correctly (forevermore, I think).

Repro here.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Hi,

    FixedColumns doesn't appear to be enabled on your table. x-scrolling is enabled, but you have max-width: none on the table, so it will just keep expanding forever and scrolling in the table will never be activated (and therefore also FixedColumns won't be - even when enabled).

    You could try max-width: 100%, but generally we haven't tested DataTables much as an expanding table - normally its just a relative fixed width, so it is possible there are quirks here.

    Allan

  • mbaasmbaas Posts: 67Questions: 24Answers: 1

    It's surprising that you mention fixedColumns was not enabled. I had set it true, doesn't that suffice? Or did you mean that it not effective, because the table has no max-width? I guess you are referring to the CSS-Attribute, right? Should that be set on the table or on a wrapper-div that contains the table?

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    I'm getting a connection refused error from the server at the moment, but I think yesterday I didn't see a fixedColumns option in the table's configuration. Possibly I missed it...!

    guess you are referring to the CSS-Attribute, right?

    Correct.

    Should that be set on the table or on a wrapper-div that contains the table?

    On the table.

    Allan

  • mbaasmbaas Posts: 67Questions: 24Answers: 1
    edited May 2018

    Thanks - you were right about the fixedColumns missing from the table-def. I must have taken it out for an experiment and then forgotten to re-enable it. But I've done some more tests and it seems yadcf-Filtering causes the display issue - so that's an issue to take up elsewhere.

    BUT wrt max-width: it is now set to 80% (and the server is restarted) - yet it keeps expanding outside the screen?

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Try using width: 100%; as a style property (not just in the CSS). It won't give the layout that you are looking for, but I think it should stop the overflow.

    I think this is an area where width control in DataTables needs to be improved.

    Allan

  • mbaasmbaas Posts: 67Questions: 24Answers: 1

    Thanks! I've made some progress now getting to the bottom of my issues - so I may come back if I find a good repro ;-)

This discussion has been closed.