misalign when use Fixed Column

misalign when use Fixed Column

marsmars Posts: 29Questions: 2Answers: 0
edited April 2013 in General
hi allen

i use DataTables for a long time and it gives me excellent experiencing. but i meet a problem when i use Fixed Column plugin these days.

here comes the discription:
i use ajax to get table data from server and fix the first 5 columns of head. it seems datatable works fine for the initialization. but when i click one head column, the datatable sort this column. then the misalign appears between table head and table body.

would you please do me a favor?

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Please link to a test case: http://datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read
  • marsmars Posts: 29Questions: 2Answers: 0
    sorry for asking you a question. does the website "http://live.datatables.net" supply the way to get data via using ajax ? or the website "http://jsfiddle.net" supply the way to include datatable plugin?
  • marsmars Posts: 29Questions: 2Answers: 0
    hi allan

    i had update the test case. the case has the same issue but not getting data via ajax.
    here comes the link:
    http://live.datatables.net/uzogad/17/edit

    when you sort the column, the head has a mislign with body.
  • marsmars Posts: 29Questions: 2Answers: 0
    hi allan

    i am not sure whether you know the test is done. would you please see it?
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Yes, thank you for the test.

    The Ajax data is available using `/examples/ajax/sources/{file}` - which is pointing to the files in this directory: https://github.com/DataTables/DataTables/tree/master/examples/ajax/sources

    There is without doubt some misalignment in your example (I've added borders here: http://live.datatables.net/uzogad/18/edit ). I'll need to look into why this is happening. It will probably take a little bit of time to figure out what is going wrong, so I'll need to come back to this in a few days (in a bit of a rush at the moment!).

    Allan
  • marsmars Posts: 29Questions: 2Answers: 0
    hi allan

    Thanks for your help. i spent some hours for this problem and here comes my found:
    1) the bigger i set the width of table's parent container(div), the better the table looks.
    2) i see the source code of Fixed Column plugin and found the plugin copy the head row of DataTable. then use the copy head row and DataTable's body to make up a new table (the plugin set the copied head row's height with zero, so the copied row can be not seen). because the head DataTable's head and body are not in a table, the misalignment maybe appears sometimes(just in my opinion).
    3) base on 2), i reset the DataTable manually in the fnDrawCallback fuction, and there is no misalignment between head and body, but misalignment also appears between body and footer. so i think the way is not good enough. and here comes my test:
    http://live.datatables.net/uzogad/20/edit#preview
  • marsmars Posts: 29Questions: 2Answers: 0
    hi allan

    is there any result now? i am sorry for asking you so frequently
  • marsmars Posts: 29Questions: 2Answers: 0
    hi allan

    did you have found out the reason yet?
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Not sure why this isn't working I'm afraid. I'll need to look into it further. I'll try to make some time over the next few days, but can't promise a fix, as things are fairly busy at the moment!

    Allan
  • marsmars Posts: 29Questions: 2Answers: 0
    Thanks in advance for your help. No matter if the issue is fixed, the datatables plugin has already made my development very convenient.
    hope your good news~
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Phew - got it. It was working with my local version of FixedColumns, but not on the live site, so it took me a little while to realise what was happening. Basically the build script for the nightly version of FixedColumns hadn't been updated for the file name change...

    What to do is use the nightly version that is available here: http://datatables.net/download/build/dataTables.fixedColumns.nightly.js

    You test case with that version of FixedColumns: http://live.datatables.net/uzogad/22/edit

    This will all be sorted out with the next release of FixedColumns, which will be alongside DataTables 1.10.

    Allan
  • marsmars Posts: 29Questions: 2Answers: 0
    thanks indeed~

    i test the nightly version of FixedColumns via http://live.datatables.net/uzogad/22/edit
    and i found another issue about it.
    1) when i sort the column of "id", misalign also appears.
    2) the scrollbar-x may be sometimes disabled in FF or Chrome. i will also test more about the nightly version and send the feedback to you.

    at last, thank you very much and best regards
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Ah darn. Good one... I'll look into that.

    Allan
This discussion has been closed.