Grid width = content width without line breaks

Grid width = content width without line breaks

julianojuliano Posts: 9Questions: 0Answers: 0
edited June 2013 in General
How can I have datatables with horizontal scrolling as the grid width expands to hold the content without line breaks?

Replies

  • koosvdkolkkoosvdkolk Posts: 169Questions: 0Answers: 0
    http://www.datatables.net/examples/basic_init/scroll_x.html
  • julianojuliano Posts: 9Questions: 0Answers: 0
    I'm already using this code, but it's not working. I think DataTables has some problem to resize it and its columns when using an Ajax datasource.

    I've posted a code sample at StackOverflow: http://stackoverflow.com/questions/17180204/columns-are-not-resized-when-ajax-request-is-complete
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Use `th, td { white-space: nowrap; }` in your CSS.

    Allan
  • julianojuliano Posts: 9Questions: 0Answers: 0
    This just makes everything stay in the same line, but does not solve the table width problem. The overflow-x is not working as the table is always limited to the container width somehow.
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    In future please link to a test case as noted in the forum rules: http://datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read

    Reading your SO thread, since there is no information provided here, you have:

    > 'sScrollXInner': "110%",

    Remove it. That fixes the scrolling at 110% of the width of the table which I very much doubt what you want.

    But without a test case, I'm really just guessing.

    Allan
  • julianojuliano Posts: 9Questions: 0Answers: 0
    Sorry about it.
    I had the problem solved by setting sScrollXInner to a higher value (like 150%) and bAutoWidth to false. Also, the fnInitComplete is not necessary.

    PS: removing sScrollXInner didn't work.
This discussion has been closed.