[SOLVED] Different behaviour with FixedColumn on datatables vs my site

[SOLVED] Different behaviour with FixedColumn on datatables vs my site

MisiuMisiu Posts: 68Questions: 4Answers: 2
edited March 2014 in DataTables 1.9
I'm trying to integrate FixedColumn to my table.
I've created my page with table already in it (no server side processing), added FixedColumn but I get weird behaviour.

I've recreated my issue using live.datatables: http://live.datatables.net/umuwij/3/edit

I want to create table with 2 left columns fixed (like here: http://datatables.net/release-datatables/extras/FixedColumns/two_columns.html)

On datatables site scrollbar isn't placed below first 2 columns, in my example it is below whole table.

1. How can this be fixed?
2. On my site I have dynamic number of columns, can I use "sWidth" to determinate "sScrollXInner"?
If I'll have 10 columns and everyone of them will have sWidth set to 100px then sScrollXInner should be 1000px, but if I'll have 30 columns it should be 3000px. I would like to avoid setting "sScrollXInner". Can this be done?

Replies

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    A few things going wrong here:

    1. The camelCase notation ( `leftColumns` ) only works if you are using DataTables 1.10
    2. iLeftWidth has no effect in FixedColumns 3
    3. I would very strongly suggest you don't use sScrollXInner . It won't even be documented in 1.10 - it was a mistake of mine to put it in at all! Just remove it and let the browser do the calculations.

    I've added `tbody td { white-space: nowrap }` to your CSS to allow the scrolling to occur.

    I've also updated the scripts to use DataTables 1.10 and it appears to work okay now: http://live.datatables.net/umuwij/4/edit

    Allan
  • MisiuMisiu Posts: 68Questions: 4Answers: 2
    Works perfect!
    I wasn't using 1.10 because it is still in beta, but I see now I must switch to it as soon as possible.

    Congrats on 1.10 it looks very promising.
This discussion has been closed.