sScrollY creates double and cols are misaligned

sScrollY creates double and cols are misaligned

avalenteavalente Posts: 3Questions: 0Answers: 0
edited December 2012 in DataTables 1.9
I use this code to generate my table
[code]
$('#myTable').dataTable( {
"bPaginate": false,
"bLengthChange": false,
"bFilter": false,
"bSort": false,
"bInfo": false,
"bAutoWidth": false,
"bDestroy": true,
"sDom": 'T<"clear">t',
"sScrollY": "500",
"oTableTools": {
"sSwfPath": base_url+"js/swf/copy_csv_xls_pdf.swf"
}
} );
[/code]
The problem is that the generated s are of different sizes respect to the corresponding s
looking at the source code I've noticed that there are two divs, one is "dataTables_scrollHeadInner" and it contains a table which contains my original and s, the other is dataTables_scrollBody and it contains a table with an empty with right size s and a with all my data.
I'm using the last version of dataTables (1.9.4).

Here a snapshot http://www.makerfaire.it/etc/datatables_error.png

Any hint?
thank you in advance

Replies

  • allanallan Posts: 63,389Questions: 1Answers: 10,450 Site admin
    Fundamentally two tables (and thus two thead's) are required for scrolling in DataTables. THe top one fixed, the second one scrolling - just scrolling a tbody is virtually impossible cross browser.

    As to might you are getting misalignment - are you getting any errors or warnings on the console? Can you post a link please ( datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read ).

    Allan
  • avalenteavalente Posts: 3Questions: 0Answers: 0
    You are right, chromium console says:
    DataTables warning (table id = 'tbl_rep_vend_mens_net_acc'): The table cannot fit into the current element which will cause column misalignment. The table has been drawn at its minimum possible width.

    And here the live example (works bad with chromium, good with firefox)
    http://live.datatables.net/igixin/12/

    thank you
  • allanallan Posts: 63,389Questions: 1Answers: 10,450 Site admin
    The problem is with `border-collapse: collapse` - without that it works okay: http://live.datatables.net/igixin/13/edit .

    If you search this site for `border-collapse` you'll find a number of posts related to this, including: http://datatables.net/forums/discussion/9350/scrollable-datatable-header-is-not-alligned-with-data/p1#Item_4

    Allan
  • avalenteavalente Posts: 3Questions: 0Answers: 0
    grrr... I'm sure I've tried removing border-collapse some days ago but nothing changed
    now it works correctly..
    maybe I've fixed other problems in the meantime and now it was the last missing tile.
    sorry for double posting and thank you for the help

    have a nice day
    a
This discussion has been closed.